Pour Liquid Nitrogen On Your Ballooning Content…Dynamic Compression in IIS7.0
Most operational folk are heads down either fixing issues, implementing new changes, or preparing environments for upcoming changes and when work is not being done we are in meetings :-). Every once in a while it is good to pop our heads up and see what is coming down the pipe.
Last week I learned a couple of new facts (out of many changes and enhancements) about IIS7 on Windows Server 2008 that I’d like to pass on to you. 1). Static IIS compression will be turned on by default and 2). Dynamic IIS compression will have configurable %cpu thresholds. Personally I get excited about anything that increases the overall efficiencies of my systems and the Internet at large, but I am also pointing these out for multiple reasons not the least of which is that not every engineer tasked with IIS administration and uptime is aware that compression is an available feature (right now).
Using HTTP Compression for Faster Downloads (IIS 6.0) https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true
Enabling HTTP Compression (IIS 6.0) https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/502ef631-3695-4616-b268-cbe7cf1351ce.mspx?mfr=true
In IIS6 turning on static compression is a no-brainer and a win/win for both you and your customers. When someone hits a page with static content (htm,html,css,js,xml..etc) IIS compresses the static files once and stores them in a cache on the hard drive – thereafter serving the pre-compressed content straight out of the cache essentially for free from a system resources perspective. You get more capacity or cheaper bandwidth costs depending upon which half of the glass you are looking at and more importantly your customers, especially high-latency and narrowband users (think international and the tens of millions in the US still using their dial-up modems), get faster page load times all because less bits are going down the wire. On one site that I previously worked with, 56k modem users saw page load times reduced on average between 60-70% when compression was enabled. That can go up or down depending upon the type of content being served.
Which brings me to my second point, IIS’s dynamic compression. It differs from static both in the types of files it works on and in that it does not cache the compressed files (asp,aspx,dll,exe). It can’t being that they are dynamically executed - every time that file is requested, it is executed and compressed on-the-fly, ad infinitum. In mscom we have rarely turned on IIS6’s dynamic compression for one reason – there was no native way to keep it from consuming all of our systems’ available cpu resources under heavy loads. This was an issue as most of our sites have tons of dynamic content and while some teams have utilized hardware based options to get around it, IIS7 changes the game. As I previously mentioned, IIS7 comes with %cpu thresholds for dynamic compression, so if your web server hits 80% cpu utilization (configurable) it will turn off dynamic compression until cpu utilization drops. This should allow you to safely squeeze more out of your web apps and servers without spending your budget on dedicated hardware. Perfect.
There are other management and performance enhancements directly related to IIS7 compression as well many other details about IIS7 that can be found on the team’s official site: https://www.iis.net.
For those who want to jump right in, I’ve pasted a sample compression section with static compression turned on from an IIS6’s metabase below for comparison. I would typically recommend using adsutil to manipulate the metabase, but edits can be done directly to it as long as the ‘Enable Direct Metabase Edit’ check box is checked in the IIS Manager GUI under your server name’s properties. Changes to this section take effect after an IIS RESET.
<IIsFilter Location ="/LM/W3SVC/Filters/Compression"
>
</IIsFilter>
<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/deflate"
HcCompressionDll="C:\WINDOWS\system32\inetsrv\gzip.dll"
HcCreateFlags="0"
HcDoDynamicCompression="FALSE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="0"
HcFileExtensions="htm
html
txt
js
css
xml
xsl
htc"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="asp
dll
exe"
>
</IIsCompressionScheme>
<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"
HcCompressionDll="C:\WINDOWS\system32\inetsrv\gzip.dll"
HcCreateFlags="1"
HcDoDynamicCompression="FALSE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="0"
HcFileExtensions="htm
html
txt
js
css
xml
xsl
htc"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="asp
dll
exe"
>
</IIsCompressionScheme>
<IIsCompressionSchemes Location ="/LM/W3SVC/Filters/Compression/Parameters"
HcCacheControlHeader="max-age=86400"
HcCompressionBufferSize="8192"
HcCompressionDirectory="C:\WINDOWS\IIS Temporary Compressed Files"
HcDoDiskSpaceLimiting="TRUE"
HcDoDynamicCompression="FALSE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcExpiresHeader="Wed, 01 Jan 1997 12:00:00 GMT"
HcFilesDeletedPerDiskFree="256"
HcIoBufferSize="8192"
HcMaxDiskSpaceUsage="100000000"
HcMaxQueueLength="1000"
HcMinFileSizeForComp="1"
HcNoCompressionForHttp10="TRUE"
HcNoCompressionForProxies="TRUE"
HcNoCompressionForRange="FALSE"
HcSendCacheHeaders="FALSE"
>
</IIsCompressionSchemes>