Web Performance: Enable data compression on IIS 6.0 server.

8 בפברואר 2009

תגיות: , , , ,
6 תגובות

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…

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. (*) שדות חובה מסומנים

6 תגובות

  1. alikl8 בפברואר 2009 ב 8:09

    Very good walk-through
    Goes directly to my KB
    Thanks for sharing it!!

    להגיב
  2. Maor David-Pur8 בפברואר 2009 ב 10:32

    very detailed one. Thanks for sharing Mr. Frolov!

    להגיב
  3. Avi Pinto8 בפברואר 2009 ב 15:44

    פוסט מעולה תודה :)
    רק נקודה קטנה:
    לא ממליץ להשתמש בפיצ'ר של הוספת תמונה מ
    WLW
    יוצא ממש מטושטש

    להגיב
  4. Frank Rizzo10 בפברואר 2009 ב 9:58

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

    http://angryhacker.com/blog/archive/2007/09/08/iis-compression-and-.net-web-services.aspx

    Much simpler.

    להגיב
  5. Govardhana28 בינואר 2010 ב 8:37

    its working gr8
    even i'm too late, its better than never

    להגיב