Logo Home   Downloads   Up to Bluedog Limited
Using HTTP compression with SharePoint
Posted on 11/20/2005 3:48 PM by Maurice Prather
November 20, 2005 update:
 - Updated links to reference and follow-up articles.
----------
August 28, 2004 update:
 - Added note to instructions for turning on dynamic compression.
----------
August 7, 2004 update:
 - Added recommendation for dynamic compression level 9
 - Added comment to the workaround in step 5
----------
Originally published: August 4, 2004
 
For the past week, my site has been using HTTP compression.  I turned on this feature to make my (temporary) 56k lifestyle more bearable... as well as make everyone's first visit experience much more pleasant.  :)
 
In quickly searching the net for SharePoint-specific instructions, I realized no such instructions existed.  Thus, today's post is dedicated to using HTTP compression with your SharePoint server...
 
Overview
HTTP Compression is a feature of IIS v6.  By default, this feature is not turned on.  For general information on HTTP compression, the following document is extremely helpful.
 
Keep in mind that SharePoint renders both static and dynamic files.  Nearly all files rendered from "_layouts" and "_vti_bin" virtual directories are static; however, there are some aspx and asmx pages which exist in those directories.  All files from the root are considered dynamic because content is either served up by either aspx pages or owssvr.dll.  Therefore, when enabling HTTP compression you have the opportunity to utilize both static and dynamic compression.
 
It's probably safe to say that most servers can easily handle static compression.  However, enabling dynamic compression requires careful examination of both server hardware capabilities and the content being served.

Instructions

  1. Since we will be modifying the IIS metabase to enable HTTP Compression, it is important to back up the metabase first.
    • Open Internet Information Service Manager.
      Right click on the server node.
    • Click on All Tasks -> Backup/Restore Configuration.
    • Click on Create Backup button.
    • Enter a name for the backup file and click on OK.
    • Click on the Close button to close the Configuration
      Backup/Restore dialog window.

  2. Enable HTTP Compression in IIS per the instructions listed in document listed above.
  3. Specify additional document types for HTTP Compression. 

    • When the HTTP Compression is enabled, only the following files are compressed:
      • static files; htm, html and txt
      • dynamic files; asp, dll and exe

    • Open command prompt and change directory to %systemdrive%\inetpub\AdminScripts

    • For static files, run the following two commands:

      • CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcFileExtensions "css" "htc" "htm" "html" "js" "txt"
      • CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcFileExtensions "css" "htc" "htm" "html" "js" "txt"

    • For dynamic files, run the following two commands:

      • CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "asmx" "aspx" "dll"
      • CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "asmx" "aspx" "dll"

        Note: The extensions listed in the commands above is a generic list of file extensions used by SharePoint.  Due to the operation behavior of SharePoint, enabling compression of "dll" files may result in performance degradation. Please read the important note in the Things to consider section below as well as read the follow-up article Analyzing the use of HTTP compression to help you determine whether or not you should enable dynamic compression of "dll" files.

  4. Specify HcDynamicCompressionLevel.
    The range is from 0 to 10. By default, the HcDynamicCompressionLevel is set to 0. Low compression levels produce slightly larger compressed files, but with lower overall impact on CPU and memory resources. Higher compression levels generally result in smaller compressed files but higher CPU and memory usage. Run the following commands to adjust the compression levels:

    • CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel "9"
    • CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel "9"

      Note: Level 9 offers the best compression without consuming too much processor time.

  5. Apply workaround from KB article 841120
    This is only necessary if you've chosen to include "dll" files for dynamic compression.
  6. Reset IIS service by running IISRESET.EXE in the command prompt.

Things to consider...

  • These instructions encompass the majority of file extensions used by SharePoint.  You may find it beneficial to add/remove file extensions depending on your needs and server resources.
  • Dynamic compression consumes server resources with each request.  If you have the processor bandwidth, the opportunity to enable the functionality exists. 
  • Even if you have processor bandwidth, it may be helpful to see how dynamic compression impacts your rendering time.  This will require you to compare rendering times with compression both on and off.
  • IMPORTANT: Given that nearly everything coming out of the root virtual directory is processed by owssvr.dll, enabling dynamic compression of "dll" files may not be the best option.  What is the majority of your content?  Is it zip files, images, other files which can't be easily compressed or are already compressed?  If so, then enabling dynamic compression may an unnecessary server burden.
  • You can test compression results with WFetch or Fiddler.  Simply put, your request will need to include an "Accept-Encoding: gzip" header.  The server response will then correspondingly have a "Content-Encoding: gzip" header (along with the compressed content).
Additional references
KB article 234497 - Specify Additional Document Types for HTTP Compression
 
===
Series articles:
Post 1/2 - you're reading it!
Post 2/2 - Analyzing the use of HTTP Compression
 
re: Using HTTP compression with SharePoint
The considerations you mention MUST be looked under all circumstances.
 
I tested my site with IIS Compression enabled a while back - the processor overhead and subsequent render time were prohibitive on the machine hosting the site so I disabled it again straight away.
 
Admittedly, the PC has only a PIII 1GHz.
Colin Walker @ 8/5/2004 1:54 AM
re: Using HTTP compression with SharePoint
What kind of change in throughput or response time did you see? If you have any benchmarks you could share the insight would be appreciated!
Sam Wilson @ 8/5/2004 6:19 AM
re: Using HTTP compression with SharePoint
Now that I've returned from vacation, I'm planning to get a full before/after comparison.
 
(i've removed the values originally posted as i discovered i was looking at invalid data.  i'll repost values once the analysis is complete)
Maurice Prather @ 8/5/2004 9:37 AM
re: Using HTTP compression with SharePoint
I did use an accelerator with compression in the SPS2001 era .... worked fab
Anonymous User @ 8/6/2004 4:19 AM
re: Using HTTP compression with SharePoint
Check out http://www.intesoft.co.uk for their ASP Accel. component - this compresses both static and dynamic output.
 
I've used it and it's quite good, although there is a freeware implementation out their somewhere - look for the C# implementation of Z-Lib
anonymouse @ 8/6/2004 6:53 AM
re: Using HTTP compression with SharePoint

I've posted an analysis of how HTTP compression affects server performance ... it's the benchmark data a lot of folks requested.

http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?id=64

Maurice Prather @ 8/6/2004 4:16 PM
re: Using HTTP compression with SharePoint
Hi Maurice, flattered you took up the suggestion, great post on the detail of how to implement it, especially the performance report you did.
 
Did you try adding office documents to the static list? .doc, .xls etc I think would benefit greatly from compression. Would be interesting to know what difference it made to a user on a 56k modem as well as the impact it had on the server...
 
Only thing I would add is that I have seen articles saying that level 10 compression has a very high processor impact for little compression benefit over level 9. you can get almost identical compression for less server load at level 9.
 
 
again, thanks for the research on the performance..
Giles @ 8/7/2004 9:36 AM
re: Using HTTP compression with SharePoint
Good comments...
  • Unless you are storing .doc, .xls files in _layouts or _vti_bin, specifying those file types in the static list won't do you any good.  If those files are stored in a document library, they are served up by owssvr.dll, which is categorized as an application file (i.e. handled by the dynamic compression engine).

  • Even with the "less than optimal" configuration of compression level=10 and dynamic compression of dll files, I found my 56k lifestyle vastly improved.  Even though my RPS may not have been the fastest it could be due to the settings, the slowness due to the pipe was more noticeable than any server slowness.

  • I've updated the analysis with test results using compression level 9.  The numbers clearly show that level 10 *really* slows things down.

I appreciate the feedback... :)

Maurice Prather @ 8/7/2004 5:31 PM
re: Using HTTP compression with SharePoint
The IIS 6 Resource Guide also has a lot of good info on compression. 
 
Also, user beware is a must.  Given that your testing had the stress client running on the server, the impact of the client may skew the results more than one would suspect (since the overhead of the client isn't constant - it is based on the number of bytes recieved). 
 
I would agree that if the Network is a bottleneck, enabling compression is generally a GOOD thing.  I also agree that for the static (to IIS) files, ie those in the _layouts directory, it is a GREAT thing.
 
Jeff Johnson @ 8/11/2004 4:08 PM
re: Using HTTP compression with SharePoint
I dont mean to be rude but your site isn't the quickest on first visit even now. If you visit the microsoft www.sharepointcustomization.com/finance website, it loads like lightning! How do they do that?
Cheers
Paul
Paul @ 4/6/2005 5:43 PM
re: Using HTTP compression with SharePoint
They can afford a big pipe.  My system is running from home over a standard cable modem.  Kinda like comparing a coffee stirrer to a baseball bat.  :)
 
Maurice @ 4/6/2005 5:50 PM
re: Using HTTP compression with SharePoint
Hi Maurice,
 
Thanks for sharing this information. After enabling HTTP compression I noticed a significant increase in performance on my Portal Server.
 
One thing I also did was use the /3GB switch in the Boot.ini file which also increased the performance significantly:
 
My portal is extremely fast now - no more waiting around for pages to load.
There were also a few tricks I did in regards to the Worker Process configuration in IIS - but the main performance gains came from the HTTP compression and the /3GB switch.
 
 
Nick Porter @ 5/12/2005 1:04 AM
re: Using HTTP compression with SharePoint
Hi all,
 
Since I activated IIS Compression I have a strange problem. Now on my portal pages when I click on a pdf link a blank page open and if i want to see the pdf I need to press F5 or back again to the page to display the PDF.... But after when this page is in my IE Cache I can click again on the link and the page can display without problem. It 's only when i want to go for the first time....
I don't know why I have this problem now because just before activate the IIS compression everything working fine...
If you can help me it will great...
Bests Regards.
Fred
Fred @ 1/24/2006 7:20 AM
re: Using HTTP compression with SharePoint
Fred,
 
Chances are you are bumping into weirdness with your browser's cache...  have you trying clearing it or perhaps browsing from a different machine?
 
Maurice @ 2/3/2006 6:27 PM
re: Using HTTP compression with SharePoint
I have followed your, very detailed yet clean, instructions on how to set up HTTP compression for WSS.
 
Now I am currently evalutating the use of the SOx accelerator over a WAN and to me surprise I do not see any of the content being served to the client in the % \IIS Temporary Compressed Files
 
Any idea why the files from the subsite would not be compressed?
Gerard @ 6/29/2006 7:20 AM
re: Using HTTP compression with SharePoint
Gerard,
 
The content will only be served if it is requested by the client.  If the client's request header does not contain an "Accept-Encoding" header, the non-compressed content is sent to the client.  See the last bullet in the post for more info.
 
-Maurice
 
Maurice Prather @ 6/29/2006 11:53 AM
Using HTTP compression with SharePoint
This may shed light on your cache problem.
http://support.microsoft.com/default.aspx?scid=kb;en-us;319384
John @ 10/26/2006 8:08 AM
re: Using HTTP compression with SharePoint
Hi,
I brought http zip and cache software from www.port80software.com and it worked until SP1 of Windows Server 2003 then caused IIS worker processes to terminate. The company were very good trying to help but I had to turn it off to avoid IIS issues.
Just a random thought, I enjoyed reading everyones posts.
Regards
Paul
IIS Work Threads @ 11/19/2006 6:35 AM
re: Using HTTP compression with SharePoint
CSS files still comes with compression even though i have not passed Accept-Encoding:gzip attribute, with this problem page is not rendering properly. i want let user to decide whether they want compression or not. any solution for this?
SSirigere @ 11/20/2006 1:39 AM
re: Using HTTP compression with SharePoint

SSirigere:

Try flushing your browser's cache before revisting the target page.  IIS will not return a compressed page unless the incoming request contains the Accept-Encoding header.

Maurice Prather @ 11/20/2006 12:32 PM
re: Using HTTP compression with SharePoint
Does anybody know how to enable Office to open files in Sharepoint in compression mode?
 
If IIS compression enabled and if you open xls file in IE browser then compression works (I see it in netmon 3), but if you open xls in Excel (it uses WebDav client) then xls flies uncompressed.
Daniyar @ 6/19/2007 7:28 AM
Microsoft Certified Master
Are you looking for a team of SharePoint experts?
ShareSquared can help ... drop us a note.
 
 
ShareSquared, Inc.
MVP Logo
Keyword Search
 
View by category
 

Disclaimer:
The contents of this site represent thoughts and opinions of the authors , not those of anyone else - such as past, present and future employers.  This a forum of the exchange of ideas centered on SharePoint technologies.  It is not a support channel.  :)

Copyright © 2004-2009 BluedogLimited.com. All rights reserved.