Very good benefit, for very little work – IIS Compression for IIS6

I’ve seen quite frequently that many applications have not implemented compression. I personally, think it’s great, simply because processor power is fairly cheap and the faster I can deliver content to my users the better. To me, the negligible difference in processing power is definately worth the increase in user experience when pages load sometimes 2 to 3 times faster.

Before we get started, I think it would be beneficial to take a trip to a compression reporting service to see if your server is currently using compression and if not, what potential benefit you would most likely receive. These compression reports are usually free and only require a URL to do the analysis. I have used PipeBoost in the past to display compression reports.

Ok, now that you can quantify the potential benefit, let’s get started by showing you my personal settings for IIS compression. Many thanks to Frendy who originally turned me on to the benefits of IIS compression and allowing Microsoft’s IIS compression engine to do all the work rather than writing my own HTTP modules for it.

Keep in mind, for your own application you may want to have different settings than what I’ve chosen. I will not go into the detail of each setting, however, this should give you a jumping point to dive a little deeper for your particular application.

Changing IIS to Enable Compression

The first change needs to be made by going to:

IIS Manager > Right click on Web Sites > Click Properties > Click the Service Tab

Change the screen to look similar to the following (Checkmark Compress application files and Compress static files):

Website Properties in IIS

Changing the Metabase.xml

Next, we want to change the metabase.xml file to direct IIS on the compression scheme we want to use. I set up schemes for both gzip and deflate (though gzip is most often used I believe).

You will want to add the following section to your metabase.xml file directly below the <IIsFilter></IIsFilter> section.

Note: This may already be there, if so, simply review the values and match them up appropriately.

<IIsCompressionScheme	Location ="/LM/W3SVC/Filters/Compression/deflate"
		HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
		HcCreateFlags="0"
		HcDoDynamicCompression="TRUE"
		HcDoOnDemandCompression="TRUE"
		HcDoStaticCompression="FALSE"
		HcDynamicCompressionLevel="9"
		HcFileExtensions="htm
			html
			txt
			js
			css"
		HcOnDemandCompLevel="10"
		HcPriority="1"
		HcScriptFileExtensions="asp
			dll
			exe
			aspx
			asmx
			ashx
			asbx
			axd"
	>
</IIsCompressionScheme>
<IIsCompressionScheme	Location ="/LM/W3SVC/Filters/Compression/gzip"
		HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
		HcCreateFlags="1"
		HcDoDynamicCompression="TRUE"
		HcDoOnDemandCompression="TRUE"
		HcDoStaticCompression="TRUE"
		HcDynamicCompressionLevel="9"
		HcFileExtensions="htm
			html
			txt
			js
			css"
		HcOnDemandCompLevel="10"
		HcPriority="1"
		HcScriptFileExtensions="asp
			dll
			exe
			aspx
			asmx
			ashx
			asbx
			axd"
	>
</IIsCompressionScheme>       
    

That’s all there is to it. You should get a pretty strong benefit from compression depending on your particular setup; hope this helps!

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