Jeff Coding Horror Atwood recently posted an interesting and enlightening article about how he is reducing his site’s bandwidth usage.
As Jeff hints, these changes were prompted by the high bandwidth demands of his recent Why Can’t Programmers... Program? post (a.k.a. - The FizzBuzz Test). At it’s peak that post kicked his bandwidth usage up to 9GB in a single day.
In looking at his pretty bandwidth usage graph I also noticed his typical daily bandwidth is around 2.5GB. Now, I’m not nearly as popular a blogger as Mr. Horror, so I don’t expect that my daily bandwidth usage is even in the same ballpark. But that doesn’t mean that my readers shouldn’t benefit from a snappier page-load time, does it? Besides, there is nothing wrong with being a good net-izen and saving a little bandwidth where we can, is there?
Turn on IIS Compression
So I decided to enable HTTP Compression on my server.
I did a little Googling and found a great step-by-step guide from Scott Forsyth explaining how to turn on HTTP (GZip) compression on for IIS 6.0. The only addition I have is a snippet of my MetaBase.xml file that shows the file extensions you’ll probably want to enable compression for (my additions are in bold):
<IIsCompressionScheme
Location="/LM/W3SVC/Filters/Compression/deflate"
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="0"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="FALSE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
html
txt
xml
css
js
rdf"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="asp
dll
exe
aspx
asmx"
>
</IIsCompressionScheme>
<IIsCompressionScheme
Location="/LM/W3SVC/Filters/Compression/gzip"
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="1"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
html
txt
xml
css
js
rdf"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="asp
dll
exe
aspx
asmx"
>
Is it any faster?
I did some before-and-after testing of various pages on my site and I’ve already seen a 75% savings in file size with compression enabled. Granted, that number is only measuring the text files (.aspx, .css, .js, etc...) that are sent down to the browser.
I may look into Jeff’s suggstion of outsourcing my image hosting at some point down the road... and I’m almost certainly going to take another look at FeedBurner for serving my RSS Feeds.
Is compression enabled on your site?
I also stumbled across this cool online utility from port80software that allows you to quickly and easily determine if your web server has HTTP Compression enabled.
Let me know if you see any odd behavior on my site - like images, .zip archives, etc... not downloading properly or being corrupted by the download process.
Happy zipping to you!
Tags: httpcompression gzip bandwidth codinghorror iis webserver