HTTP Compression and IIS 6.0

HTTP compression is the ultimate no-brainer. The network is really slow, and CPU time is effectively free and geting faster and, uh, "free-er" every day. Compression typically reduces plaintext size by 75 percent: that quadruples your throughput! Every website should be serving up HTTP compressed pages to clients that can accept it. The client indicates ability to accept compressed contents in the request headers:


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2004/08/http-compression-and-iis-6-0.html

Hi Jeff,

I havent looked into IIS6 (“completely new and much better than IIS5)”, so I assumed that MS would have fixed the compression thing. However, this seems not to be the case.

Would it make sense to port FlatCompression to IIS6?

Yours,

Uli M.

Hey Uli! Great to hear from you again.

We still use your excellent FlatCompression dll on our IIS5 servers at work with great success!

As for IIS6, the compression is fixed, it’s just kind of a pain to configure. The documentation is flat-out wrong in a lot of places and misleading in others. But once you get it configured, it does work…

Not sure if you have seen this article:

http://beta.orcsweb.com/articles/iis_compression_6.0.aspx

It covers “those other parameters” which you originally missed.

this gives additional data points on actual performance before and after enabling compression. There is some coverage about SSL with compression.

a href="http://www.intel.com/cd/ids/developer/asmo-na/eng/208335.htm"http://www.intel.com/cd/ids/developer/asmo-na/eng/208335.htm/a

Dr. Uli’s code is about 3 years out of date. It uses the zlib library, and the source shows quite an old version. I wonder if it’s vulnerable to the recently found and fixed zlib buffer overflow vulnerability he predicted in his readme notes?

this gives additional data points on actual performance before and after enabling compression.

Interesting… so on relatively old 500mhz and 700mhz processors, IIS compression increases CPU utilization 25-35% for dynamic pages (compressed each time). And only 10% for SSL since the SSL overhead is already so high. Not bad!

These are old posts but I’d like to add my 2 cents. My IIS 6.0 HTTP compression was not working because I had a McAfee virus scanner running in parallel. Once I turned off the On Access Scan, it started to compress the downloaded files.

I notice you’re using a compression level of 10 in your example. Scott Forsythe has commented that a level of 10 can be more more cpu-intensive than a level of 9, but with little effective increase:
http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx

Can you tell me how to determine if http compression is enabled? My site is not hosted on my own server so i can’t see that in the iis manager.

Any help would be appreciated.

Hi Gerald,

I use this page to test if compression is working:

http://www.port80software.com/products/httpzip/compresscheck

When I use the compressing, I receive for one of my pages a blank screen. When I open the page in notepad I get the following:

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTML {955246E3-6933-480d-B146-2462CE868767}=“true”
{95F2CBFC-289F-4e9e-9972-50F36660DAEC}=“0”
{55671E03-16F5-412c-97E7-648282E1183B}=“true”
{F92F6ACC-5E50-4482-BC62-9D8DF61E5A32}="5"HEAD
META http-equiv=Content-Type content=“text/html; charset=utf-8”/HEAD
BODY/BODY/HTML

For all other pages the compression seems to be working fine…
Any ideas on this one?

Just wanted to mention IISxpress here, it’s a really good piece of compression software and compared to the pricing of many of the other ones it’s a bargain.

http://www.ripcordsoftware.com/IISxpress/IISxpress_for_IIS.aspx

For those posters wanting to know how to check if compression is enabled on their internal servers, here is the answer. You need to see the headers returned by your server, there are several ways to do this.

You could use a packet sniffer (Wireshark), an http proxy (proxomitron, fiddler) or a browser plugin (firebug for firefox). My personal favourite is Firebug as it allows you to see a lot more information about your site’s performance, especially if you download the YSlow addon.

Alternatively, if you download the Pipeboost demo from port80, there is a header analyser tool included.

I can’t get this to work w/ IIS on Windows XP Pro because the inetmgr doesn’t have things like snapins and stuff…can’t even find a metabase file

works like a charm, superkewl post :

Here’s the command line options to set it all up:

ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/Parameters/HcDoDynamicCompression TRUE

ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDoDynamicCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcFileExtensions “asx” “css” “doc” “htm” “html” “js” “txt” "xml"
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcScriptFileExtensions “asp” “ashx” “asmx” “aspx” “axd” “dll” “exe” "svc"
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcOnDemandCompLevel 10
ADSUtil.vbs Set W3SVC/Filters/Compression/deflate/HcDynamicCompressionLevel 9

ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoStaticCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoOnDemandCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDoDynamicCompression TRUE
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcFileExtensions “asx” “css” “doc” “htm” “html” “js” “txt” "xml"
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcScriptFileExtensions “asp” “ashx” “asmx” “aspx” “axd” “dll” “exe” "svc"
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcOnDemandCompLevel 10
ADSUtil.vbs Set W3SVC/Filters/Compression/gzip/HcDynamicCompressionLevel 9

IIS Reset, clear your cache, open Fiddler, open IE, make a request and voila, compressed content! One thing to note that on the dynamic level compression happens with each request. The blogosphere statea that the trade-off between levels 9 and 10 for dynamic compression is such that you will want to consider 9 because it takes exponentially less CPU versus the benefit.

I have a question…

Is it normal for compressed aspx to load slower, like 10 seconds slower? The pages were all compressed but somehow they are now loading slower…

The only issue I had was my metabase would revert after restarting IIS. The trick… right click the computer in IIS, and check “Enable Direct Metabase Edit”

My bandwidth compression has reduced by 45% - Hooray !!

But, YSlow still tells me that the files for my home page (include css, js, aspx) are not zipped. When I point my site to compresscheck (http://www.port80software.com/products/httpzip/compresscheck), I am shown a 65% drop in file sizes. I am not able to identify if ALL file types are getting compressed correctly by my IIS 6.0 server !

Any tricks/tips will be of great help - Thanks