Compression in IIS

160

There’s a relatively obscure setting in IIS that can have a dramatic effect on the performance perceived by SharePoint users.  By enabling IIS to compress the communication to the user, communication to the user can consume less bandwidth.  The trade-off is with CPU usage to compress the messages.  Note the setting is quite fine-grained, allowing you to find the optimal balance of bandwidth conversation against the available SharePoint farm WFE (Web Front End) CPU.

If you open a simple CMD window on your SharePoint WFE, run the following commands (all commands below assume this drive and directory):

c: CD WindowsSystem32Inetsrv appcmd list config -section:httpcompression

This will show you the current compression settings.   Note there are two categories of compression: Static and Dynamic.  We will want to set both.  There are more than one compression mechanism.  GZip is recommended.  The compression can be set between 0 (no compression) and 9 (ultimate).  I would suggest the sweet spot is between 4 and 7 (your mileage may vary).  Here’s the command:

Appcmd.exe  set config -section:httpCompression   -[name='gzip'].staticCompressionLevel:9   -[name='gzip'].dynamicCompressionLevel:7

I look at each environment; not just Production, but Dev and UAT environments.  Where are they located?  How many CPUs are available?  If you are running below Microsoft CPU minimums (shame on you!) then perhaps adding to the CPU load isn’t for you.  If you access your environment over a thin pipe to a remote location, then IIS Compression can make a significant difference in performance.

Let’s look a bit closer at Dynamic Compression.  There are two settings that control when compression is enabled and disabled.  The default is that when the CPU utilization is below 50% compression gets enabled.  Above 90% compression gets disabled.  The CPU utilization is sampled by IIS every 30 seconds.  I think 90% CPU utilization is rather high, given all the SharePoint wonderfulness going on in my farm, so I crank these settings down a bit with these two commands:

appCmd set config -section:httpCompression /dynamicCompressionDisableCpuUsage:50 appCmd set config -section:httpCompression /dynamicCompressionEnableCpuUsage:30

There is a setting to control the minimum size of the object before compression is applied.  The default is 256 bytes.  This applies the overhead of compression to some pretty small files.  You can choose to increase it to 512:

appCmd set config -section:httpCompression /MinFileSizeForComp:512

I found a dramatic improvement in perceived SharePoint performance for users connected over a thin pipe to SharePoint.  This includes remote users.  Give it a try, and let me know what you experience!  For more information, please reference Bill Baer’s in-depth TechNet article.

Share this entry

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents

Categories

Categories