Home > Techie > Configuation of GZip Compression in IIS6

Configuation of GZip Compression in IIS6

July 27th, 2005

GZip is automatically turned off in IIS by default, but could save on bandwidth dramatically and also cause a decrease in page load time from clients. And if your worried about all your dynamic content, it’s actually easier to compress this then static. Well, they both have their up’s and downs.

Dynamic content is compressed on the fly, which means extra cpu load for each request. If your server is not under load then there is no problem. Even if it is under load, you can still change the compression levels.

Compression Levels

Compression Levels can be set within the “MetaBase.xml” file (for IIS 6+). If you search for GZip within this file, you should be able to locate and change the relevant options. Remember to change both GZip and Deflate, for both dynamic and static.

The values range from 0 (Minimum) to 10 (Maximum)

The default is set to 0, which does enable a good compression at very little performance cost (60-80% compression is not uncommon), but if you do have the extra power, 9 offers the best compression versus cpu load. A word of warning however, level 10 dramatically increases load with little or no gain in compression.

Static Content

To set your static files, simply add the file extensions to the end of the GZIP and DEFLATE commands.

When a request is made, it first checks the temporary directory to see if it has a compressed copy, which it returns. If not, it sends the original file to the client, then compresses the file and saves it for future requests. The maximum directory size can be specified within the IIS manager.

Within Inetpub\AdminScripts\

cscript adsutil.vbs SET W3Svc/Filters/Compression/GZIP/HcFileExtensions "htm" "html" "js" "css"

cscript adsutil.vbs SET W3Svc/Filters/Compression/Deflate/HcFileExtensions "htm" "html" "js" "css"

iisreset

Dynamic Content

In my view dynamic is simpler as it is done on the fly. Again, simply add all the dynamic extensions you use for execution.

Within Inetpub\AdminScripts\

CSCRIPT ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "aspx"

CSCRIPT ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "aspx"

iisreset

Techie ,

  1. No comments yet.
  1. No trackbacks yet.