Lately I have been concerned with and researching how to improve web site performance. This interest has led me to the guru on the subject, Steve Souders, and his book, High Performance Web Sites. The book has 14 rules to improve site performance that Steve developed in his tenure as the Chief Performance Yahoo at Yahoo!. I would like to go through some of the rules and how they are applied to the Marblehead site and share our results. While Marblehead’s site is small and probably not a site that needs a lot of performance tweaks, it is a site that we can experiment with to see the benefit of new techniques.
Reducing HTTP Requests
The first rule, reduce HTTP requests, had room for massive improvement on our page. Souder’s research shows that 80% of the time a page is loading is spent sending and receiving HTTP requests for each component of the page. We can see the importance of reducing the amount of requests a page makes.
I hold to the philosophy that images, unless part of or relevant to the content, should not be in HTML, and design elements should be placed as CSS background images. Unfortunately, having too many CSS background images can increase the amount of HTTP requests a page makes. As you can see from the picture, our page was making around 34 HTTP requests just to download images, JavaScript, and style sheets, resulting in an F grade in YSlow. The biggest problem was that our page was requesting a lot of CSS images. There are a few options to reduce the amount of CSS image requests: putting all the images in the HTML, building image maps for navigation, or using CSS sprites. My happy medium was to use CSS sprites. Using images inline did not fit with my development philosophy and really neither did using image maps.

I use CSS sprites frequently to create hover states for navigation items and buttons, but have never used them as I have here. The technique is straightforward. Create one large image of all the images and then simply position the background to the desired area for the specific element. I needed to compromise between file size and HTTP requests, so I created 5 images to be used as CSS backgrounds: one large image for the page’s background, one image for the headlines to use for image replaced text, one image for the primary navigation items, and one image for the secondary navigation items. Doing so got me from an F grade in YSlow and making 41 HTTP requests to an A grade and making 26 HTTP requests.
Gzip & Reducing File Size
The next aspect of the page that needed improvement was file size. Making your files as small as possible can improve site performance exponentially, especially for users with lower bandwidth. One of the easiest ways to reduce file size is to Gzip your site components. Compressing files can be handled automatically through Apache with the mod_gzip or mod_deflate modules. It just takes a bit of configuration to make sure the right files are compressed. Typically only HTML files are compressed but for maximum benefit you should also compress scripts and style sheets. The results on our site was quite surprising for me.
Compressing images, PDF files, and other binary files through Apache’s modules is not a good idea. Typically this is a waste because these files are already compressed and using gzip in certain cases can result in larger file sizes. However, there are other options for reducing file size in images besides gzip. First, you should use Fireworks as your image creation tool; it has better compression with image formats than Photoshop or any other image editing tool that I know of. Second, unless an image is especially small, use PNG instead of GIF for images. The PNG file format has many advantages over the GIF format: it typically has greater compression resulting in smaller file size, it has more options for transparency, and it supports a wider range of colors and color profiles. Some of the advantages, like alpha transparency and color profiles, are limited by browser implementation, but overall it is a better format to use. You can also get your PNG file sizes even smaller if you run them through a second compressor like PNGOUT or OptiPNG. The results can be quite extraordinary; in our case we saved around 20K.
Adding Expires Headers
Another area with room for improvement was optimizing the cache settings for our assets. Cacheing assets is another way of reducing HTTP requests on subsequent page views for returning visitors. Setting a far future Expires header for assets tells web browsers that they can use the current version of the asset until that date occurs. I chose to take Steve’s recommendation and set an Expires header for 10 years for image, style sheet, and script assets. Doing so has reduced the requests on our page in subsequent visits to 3, the HTML file and two third party assets that we don’t have control over. There is one caveat to be aware of with setting Expires headers so far into the future, doing so causes the browser to not download new versions of the asset. It is recommended then in your build process you build some way to version your file names so that browsers will download new versions of the file.
The application of these rules has increased our site’s performance. There are some other techniques that we have applied, and I’ll talk about those in a future post. I wanted to share our findings and show how effective these techniques can be.
- Cuzillion - a configuration testing tool built by Steve Souder
- YSlow - a performance testing extension
- Examples of rules from High Performance Web Sites book
- Using Fireworks: Enterprise Fire-Flow by Nathan Smith

Leave a Comment /
Cancel Reply