DCSIMG
Web Performance: Enable data compression on IIS 6.0 server. - Yevgeni Frolov

Yevgeni Frolov

Web Performance: Enable data compression on IIS 6.0 server.

In my previous post I've introduced YSlow - an Firebug’s add-on that helps to analyze and improve web site performance. One of the easiest ways to improve web application performance is to enable data compression. Enabling data compression on IIS 6.0 server can save up to 80% of network utilization by the price of up to 10% and often less than 1% of CPU ratio without changing single line of code.

Apparently, enabling data compression on IIS 6.0 is not that straight forward task as it looks. Most people that are using IIS as a hosting server mistakenly think that enabling data compression on “Web Sites properties” is enough… well it’s not - this is only the first step in that process.

So here is how it really goes step by step:

1.  Enable compression functionality on IIS server management tool:

  • Right click on “Web Sites” folder in IIS management tool , click on Properties
  • Select Service tab in opened dialog
  • Check “Compress application files”
  • Check “Compress static files”
  • Define a folder for compresses cache storage(possible to use a default)
  • Select a limitation mode for compressed cache (Only compressed static files are cached)

 

image

2.  Enable editing of meta data file manually:

  • Right click on IIS root, click on Properties
  • Check an “Enable Direct Metabase Edit” option

image 

3. Edit meta data file:

The meta data file called MetaBase.xml is located at %windir%\system32\inetsrv\MetaBase.xml.

Warning!

Changing MetaBase.xml can harm IIS server functionality if not handled properly, though it is crucial to backup file before making any changes.

XML compression configuration node name is “IIsCompressionScheme”. There are two such nodes in a MetaBase.xml file, one for Deflate compression algorithm and another for GZip compression algorithm - both nodes should be configured.

Attributes to be changed:

HcDynamicCompressionLevel attribute defines value from 0 to 10, when 0 is most light compression level. I would recommend to set it to 9 – it seems like an optimal “performance – compression ratio” relation.

Warning!

Setting a compression level to 10 causes high CPU utilization.

HcFileExtensions attribute defines a list of static files extensions that should be compressed.(Example: js, HMTL etc.)

Warning!

Do not enable data compression on files that are already compressed (jpg files for example).

HcScriptFileExtensions attribute defines a list of dynamic files extensions that should be compressed.(Example: aspx, asmx etc.)

 image

After performing all the changes above IIS server must be restarted to apply all those changes. To check performance improvements use Fiddler or YSlow to monitor HTTP traffic.

Summary

Data compression feature is a very powerful tool for reducing network traffic, yet, no code changes are required! Still it is only one of many tweaks that are available on IIS server. About some of those I will blog very soon…

Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# February 8, 2009 7:58 AM

alikl said:

Very good walk-through

Goes directly to my KB

Thanks for sharing it!!

# February 8, 2009 8:09 AM

Maor David-Pur said:

very detailed one. Thanks for sharing Mr. Frolov!

# February 8, 2009 10:32 AM

Nadav Yeheskel said:

Great article! Very helpfull!! :)

# February 8, 2009 10:38 AM

Avi Pinto said:

פוסט מעולה תודה :)

רק נקודה קטנה:

לא ממליץ להשתמש בפיצ'ר של הוספת תמונה מ

WLW

יוצא ממש מטושטש

# February 8, 2009 3:44 PM

Frank Rizzo said:

Or you could just run the batch file that this guy provides:

angryhacker.com/.../iis-compression-and-.net-web-services.aspx

Much simpler.

# February 10, 2009 9:58 AM

Yevgeni Frolov said:

In one of my previous posts I’ve described a way to enable data compression in IIS 6.0 server. It was

# February 18, 2009 10:39 PM

Govardhana said:

its working gr8

even i'm too late, its better than never

# January 28, 2010 8:37 AM

Speed Up Your Web Site With Compression in IIS 6 | Quantum of Geek said:

Pingback from  Speed Up Your Web Site With Compression in IIS 6 | Quantum of Geek

# March 18, 2010 8:23 AM

Best Practice No 4:- Improve bandwidth performance of ASP.NET sites using IIS compression » Technology Articles - Technology And Programming Articles said:

Pingback from  Best Practice No 4:- Improve bandwidth performance of ASP.NET sites using IIS compression » Technology Articles - Technology And Programming Articles

# August 20, 2010 3:11 PM

Best Practice No 4:- Improve bandwidth performance of ASP.NET sites using IIS compression | All in one for social - Blog said:

Pingback from  Best Practice No 4:- Improve bandwidth performance of ASP.NET sites using IIS compression | All in one for social - Blog

# December 4, 2010 12:57 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: