IIS HTTP Compression

posted on 2005-02-16 at 02:07:46 by Joel Ross

Mark saved the day today. We were having some performance issues with a large number of users going over a limited pipe. He brought up http compression, and after implementing it, we saw the pipe utlization go from 95% to 50% (and users were more productive!).

So, based on that, I thought I would post what you have to do to get it going. The first step is make sure you have IIS 6.0 (Windows 2003).

Assuming you have the right version, you need to get to the service tab under the Web site properties (overall website properties, not instance web site properties). Then check the two checkboxes to compress application files and compress static files.

Next, you have two options: stop IIS, and change the metabase, or tell IIS to allow metabase edits directly. If you are running a live site, and want to make changes without the site going down, do the second. To do this, get to the properties for the IIS web server, and check the Enable Direct Metabase Edit checkbox.

The IIS metabase is located in c:\winnt\system32\inetsrv\metabase.xml. BACK THIS UP FIRST.

There are two sections that you need to find. Both are IISCompressionScheme nodes. Check the location attribute for the ones ending in deflate and gzip. Add the extensions you want to compress to either the HcFileExtensions section or the HcScriptFileExtensions section. The first is for static files (htm, html, txt, css, etc.) and the second is for dynamic files (aspx, asp, etc.). The extensions are carriage return seperated, so make sure to insert a new line between each extension.

Now, lastly, what kind of performance increase did we see? Using Fiddler, we were able to see the file sizes and compare them to a test server that didn't have it enabled on. The file sizes averaged between a 60 - 80% reduction in size (43K down to 5K for example), and one was over a 90% reduction in size (522K - don't ask! - down to a 43K file).

Overall, a very easy change for the kind of performance gain we saw!

Categories: Development