Bluedog Limited > SharePoint Thoughts > Posts > Using HTTP compression with SharePoint
November 20
Using HTTP compression with SharePoint
This post was migrated from an older system. Some links may point to content that no longer exists. Comments were not migrated.
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
 

Comments

There are no comments for this post.

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


captcha

Please verify the text shown in the image

Attachments


© 2004-2013 Okean Solutions
Aptillon, Inc.
Microsoft Certified Master - SharePoint 2010 & 2007
Sign In