in Applications, Testing, Usability

Quick site performance improvement

I have been playing with YSlow, Yahoo’s tool for web site profiling, for a while. If you haven’t tried YSlow (which is a Firefox addon to Firebug) I recommend you try it right away. Install the Firebug extension first and then add YSlow.

It is amazing how much you can improve the percieved site speed by some minor changes to your htaccess file. This site runs WordPress and I was tempted to install the WP-Super-Cache plugin but was put off by some of the incompatibility issues that were reported with the latest version of WordPress and PHP safe mode. Until then I managed to lift my YSlow site score from grade F to grade C by:

1. Removing ETag headers by adding the following lines to my htaccess file (outside the wordpress-specific rewrite area):

Header unset ETag
FileETag None

2. Setting a future expires header for static files by adding this to htaccess:

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
</FilesMatch>

If your app/blog uses some sort of dynamic generation of images you can modify the matching rule above for a more precise selection of files (e.g. only files in the templates folder).

Presto! Two simple additions to htaccess and cached access is down to two requests (of which one is Google’s javascript file for ads):

YSlow stats showing improved performance for this website.

Write a Comment here on the real web

Comment

  1. Utmärkt tips! Jag gick visserligen från B (80) till B (86) med ändringarna, men betydligt färre saker hämtas varje request. Tack!

  2. I would also recommend this online free tool: http://Site-Perf.com/

    It measure loading speed of page and it’s requisites (images/js/css) like browsers do and shows nice detailed chart – so you can easily spot bottlenecks.

    Also very useful thing is that this tool is able to verify network quality of your server (packet loss level and ping delays).