Home > IIS Stories > Enabling HTTP Compression to save network cost in IIS6 (#1/3)

Enabling HTTP Compression to save network cost in IIS6 (#1/3)

HTTP – Hypertext Transfer Protocol – has improved slowly since it was introduced. If you’re an administrator of Web Servers, you may find that you don’t have many things to make HTTP works better. (This fact is not about Windows TCP/IP & Network stuff, because there’re many.)

In other words, you have just small number of things to make your web server work better.

Using HTTP compression is one thing you can do. I’m quite sure most companies want to save network costs, or improve network capacity. HTTP Compression is for minimizing the size of responses from your web servers whenever they send data for clients(browsers).

 

Configuring HTTP Compression is composed of 5 steps as below.

(0) Create a backup of IIS Settings(Metabase)

(1) Enable ‘HTTP Compression’ in IIS property.

(2) Configure a directory to store static compressed files.

(3) Configure extensions(static, and dynamic) to be compressed.

(4) Set Compression Level (0 to 10)

 

Creating a backup of IIS Settings(IIS6 Metabase)

In IIS Manager, select the server node, and right-click, to use ‘All Tasks > Backup/Restore Configuration…’ menu.

image

Click [Create Backup] button, and type any name of your own backup, and click [OK]

image

 

How to enable HTTP Compression (IIS6)

In IIS6, first of all, you need to enable HTTP compression in IIS Manager. (There’s a script to enable this at a command prompt too.)

image

In this step, don’t select any individual web site(for example, ‘default web site’ in above screen), select ‘Web Sites’ node to change its properties in a master level. And switch to ‘Service’ tab as shown below.

image

Enable ‘Compression application files’, or ‘Compression static files’ in the check boxes.

You also can review the path to store compressed files for static contents, those are reusable for repeated requests for same URL’s.

Or,

If you want to use a script to enable compression, use the following steps,

(Note : adstuil.vbs file is located in ‘c:\inetpub\adminscripts’ folder.)
To enable global HTTP compression by using Adsutil.vbs, check the followings,

1. Open a command prompt, and set your current folder to ‘c:\inetpub\adminscripts’ to run adsutil.vbs script.

2. To enable dynamic compression, type the following at the command prompt and then press ENTER:

cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoDynamicCompression true

3. To enable static compression, type the following at the command prompt and then press ENTER:

cscript adsutil.vbs set w3svc/filters/compression/parameters/HcDoStaticCompression true

Now, you just finished enabling HTTP compression, and, this is not the end of essential steps to complete compression settings. There’re more.

It’s required to add custom extensions to be compressed. Only default extensions(file types) can be compression from now. Check the following default values,

  • Application files : asp, dll, exe
  • Static files : htm, html, txt

The above extensions are default values when you enabled HTTP compression in IIS. If you have other types for IIS to compress, then you need to add them manually by using below commands,

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcFileExtensions “htm” “html” “txt” “doc” “ppt” “xls”

CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcFileExtensions “htm” “html” “txt” “doc” “ppt” “xls”

Note : The above example is to add ‘doc’, ‘ppt’, and ‘xls’ (static files) extensions to be compressed by IIS.

In additions, if the server is running ASP.NET applications, you need to add ‘aspx’ extension – dynamic file type – manually. So, you can refer the followings to find more details,

cscript adsutil.vbs SET W3SVC/Filters/Compression/Deflate/HcScriptFileExtensions “asp” “dll” “exe” “aspx”

cscript adsutil.vbs SET W3SVC/Filters/Compression/gzip/HcScriptFileExtensions “asp” “dll” “exe” “aspx”

Note : This example command is to add ‘aspx’ (dynamic application, ASP.NET) extension.

 

It’s almost done. And there’s an optional setting, which is ‘Compression Level’. This is changing a metabase property, you can complete this by editing metabase.xml(adsutil.vbs is also available to edit the settings), anyway, there’re more considerations to edit it manually.

: Reference – Modify the IIS Metabase Directly (IIS 6.0)

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1d1e5de4-fd63-40cd-bc5d-c20521548eed.mspx?mfr=true

If you are not familiar with working with IIS metabase settings, please skip this step, and refer the followings for your information.

HcOnDemandCompLevel

The HcOnDemandCompLevelproperty specifies the compression level for the compression scheme, when the scheme is to compress static content on demand. Low compression levels produce slightly larger compressed files, but with lower overall impact on CPU and memory resources. Higher compression levels generally result in small compressed files but with higher CPU and memory usage.

Valid compression levels range from 1 to 10.

The World Wide Web Publishing Service (WWW service) must be restarted before any changes to this property take effect.

http://technet.microsoft.com/library/cc737234(v=WS.10).aspx

HcDynamicCompressionLevel

The HcDynamicCompressionLevelproperty specifies the compression level for the compression scheme, when the scheme is compressing dynamic content. Low compression levels produce slightly larger compressed files, but with lower overall impact on CPU and memory resources. Higher compression levels generally result in smaller compressed files, but with higher CPU and memory usage.

The World Wide Web Publishing Service (WWW service) must be restarted for any changes to this property take effect.

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0d785bb2-8b9b-46db-96a5-a8343970324b.mspx?mfr=true

I don’t recommend you to adjust the compression level settings, unless you are quite familiar with monitoring & checking their effects after making changes of IIS6 Metabase.

 

The last thing, restart IIS by running ‘IISRESET’. Done!

 

This’s simple, Isn’t it?

And, I’d like to mention that, in terms of HTTP compression, this post is the only page that describes all required steps without any missing, or incorrect information, in this planet. Winking smile

If you search web pages about this topic, you will find the pages are missing one or more steps to complete entire compression settings, or sample commands are incorrect.

Here’re references, check it out!

Enabling HTTP Compression (IIS 6.0)

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr=true

Customizing the File Types IIS Compresses (IIS 6.0)

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr=true

How to specify additional document types for HTTP compression

http://support.microsoft.com/kb/234497/

 

Next Posting will be about How to enable HTTP Compression (IIS7.x)

Advertisements
Categories: IIS Stories
  1. 2014/05/17 at 11:23 am

    This is a topic that is close to my heart… Thank you! Where are
    your contact details though?

    Like

  2. FSK
    2014/06/27 at 12:42 am

    Excellent post

    Like

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: