Adverts

Archives By Subject

Calendar

Mon Tue Wed Thu Fri Sat Sun
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Search

RSS


Tags

adobe apache book review cfimage coldfusion google google chrome hosting iis internet explorer java javascript jquery lucene photoshop regex ses urls software review sql injection svn trac

Subscribe

Enter your email address to subscribe to this blog.

How to tweak IIS to improve your coldfusion sites' performance

Following on from yesterday's review of High Performance Web Sites, I had a quick go with YSlow, to see where I could optimise this site.

The starting point was a respectable score of C(71) for the home-page. The first rule that didn't score well was number 2: Use a Content Delivery Network. A CDN is over-kill for a blog, so that left me looking at the following rules 3 (Add Expires Header), 4 (Gzip components) and 13 (Configure Etags).

All of these rules would be fixed on IIS, which wasn't covered in enough depth in the book. Some quick googling found the following two articles; YSlow using IIS? and IIS 6 GZIP compression.

Rule 3 (Add Expires Header)

This is fairly straight-forward - in the IIS Manager, right-click on a file or folder and HTTP Headers >> Enable Content Expiration, and set a value of 30 days. This was done for all images, scripts and css files.

Luckily this site is fairly well structured, so I just had to set this for 2 folders. Ideally though, I would like to be able to set this for all static files on the server. That way I don't need to redo this as sites change. Does anyone know an easy way to do this?

Rule 4 (Gzip components)

This only really applies to css and javascript files. Other static files such as images are already compressed, so gzipping them would only decrease performance.

The following commands at the command prompt got it going, and unlike with the rule 3, I don't need to come back to this.

cd %systemdrive%\Inetpub\AdminScripts
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "js" "css" "xml" "xlt"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "htm" "html" "js" "css" "xml" "xlt"

cscript.exe adsutil.vbs set W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "cfm" "cfc"
cscript.exe adsutil.vbs set W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "cfm" "cfc"
IISreset.exe /restart

Rule 13 (Configure Etags)

In my situation, it was best just to remove etags. To do this on the server, go to the IIS Manager and right-click on Web Sites >> HTTP Headers >> Add and set the key to "Etag" and leave the value blank. Like rule 4, this is a one-off setting for the whole server.

Result

After these 3 steps, my homepage is now up to an excellent score of B (88), and only 2 points away from an A. Even the busier blog pages still get a very high score of C (79).

Related Blog Entries

Comments
Raymond's Gravatar Thanks for the tip of how to remove etags. I searched for a good 20 minutes on the subject before finding your easy solution.
# Posted By Raymond | 04/06/08 07:17
Castor's Gravatar In reference to compression; should you add cfc files as these should never be served directly back to a browser, are they not only used in code 'server side'?

For a more complete look into setting up compression on IIS 6 see:

http://blog.grushin.com/2008/04/21/iis6-compressio...

Note however that they have got it wrong in that all the file types have been added under the "HcScriptFileExtensions" instead of the static file (js css).

HcFileExtensions should have: htm html txt js css xml xlt
HcScriptFileExtensions should have: asp dll exe aspx cfm (cfc? not sure on that one)
# Posted By Castor | 31/07/08 12:29
Gareth's Gravatar Hi Castor,

You might access CFCs directly when using them as a web-service. Possibly through flash remoting too, although it's been a while since I've done this, so I'm not sure. For this reason, you may want to add CFC to your list.
If you only use CFCs internally, then it shouldn't matter.

The only extensions you would want to avoid are where the file is already compressed e.g. jpg or mp3. Trying to compress these files will only make them bigger and waste cpu cycles.
# Posted By Gareth | 31/07/08 22:36
Vacances's Gravatar Your post was really helpfull !

I used 2 others blogs and everything was ok
http://123vacances.wordpress.com/2010/06/16/compre...
# Posted By Vacances | 18/06/10 05:29
Gareth's Gravatar As a quick update to this, I've been playing about with IIS 7.5, trying to set the same things.
Although the UI is very different, it wasn't too hard to figure things out.

Rule 3. Just click on a folder, double-click 'HTTP Response Headers', then 'set common headers' in the top right. This gives you options to set the expires headers.
There's still no ability to set expires headers for all files of particular types though.

Rule 4. IIS was already set up to compress static files. You can install an option to compress dynamic files, but it does warn about extra processing.

Rule 13. The previous trick of setting an Etag header to an empty string doesn't work. However, it seems that IIS 7.5 may configure them correctly anyway now.

If you still want the extra points on ySlow, then on the server double-click 'HTTP Response Headers'. Add a header called 'Etag', and set it to some text such as 'Dummy'. If you look at the headers in ySlow, you'll see both the IIS etag and your own header separated in a comma. This seems to be enough to trick ySlow into thinking Etags are correctly configured.
# Posted By Gareth | 12/08/10 20:48
Danny's Gravatar I'm trying out all these tips to see if I can get my Dyson vacuum review site to load faster.

http://www.reviewdyson.com

Thanks for the info!
# Posted By Danny | 03/06/11 21:12
Adobe Certified Professional - Macromedia ColdFusion MX 7 Advanced Developer Powered By ColdFusion 8 aggregated by mxna aggregated by coldfusionBloggers