We’ve developed some resources to help you work effectively from home during COVID-19 Click here to learn more

IIS Compression in IIS6.0

In this article

    You can save a lot of bandwidth (though not on latency) by compressing the responses from IIS 

    Compression level of 9 is recommended for SIX.web.
    Make sure that these types are included in the list of dynamic content:
    .aspx: Web pages
    .asmx: Web services
    .ashx: Ajax methods
     
      HcDynamicCompressionLevel="9"
      HcScriptFileExtensions="asp
                              dll
                              aspx
                              asmx
                              php
                              ashx
                              exe" />


    First, before anything else, backup the metabase. This is done by right-clicking on the server in the IIS snap-in and selecting All Tasks -> Backup/Restore Configuration. The rest is straight forward.

    IIS changes

    1. Right-click the server node and choose Properties
    2. Tick the "Enable Direct Metabase Edit"

    Create Compression Folder (optional)

    Create a folder where the static file compression will be cached, you can call it anything you want or leave the default of “\IIS Temporary Compressed Files” if that works for you. The IUSR_{machinename} will need write permission to the folder. If you use custom anonymous users, make sure to assign the proper user. IIS will still work even if the permissions are wrong but the compression won't work properly. Once running, it's worth double checking Event Viewer to see if any errors are occurring that keep IIS Compression from working.

    Enable Compression in IIS

    From the IIS snap-in, right-click on the Web Sites node and click on Properties
    Select the Service tab:

    • Enable Compress application files
    • Enable Compress static files
    • Change Temporary Directory to the folder that you created above, or leave it at it's default
    • Set the max size of the temp folder to something that the hard drive can handle. i.e. 1000.

    Save and close the Web Site Properties dialog
    Note - The temporary compress directory is only used for static pages. Dynamic pages aren't saved to disk and are recreated every time so there is some CPU overhead used on every page request for dynamic content.

    Create a Web Service Extension (WSE)

    IIS6.0 is much more proactive than IIS5 in regards to security and introduces a new feature called Web Service Extensions. This is great but means an extra step.

    In the IIS snap-in select Web Service Extensions
    Create a new web service extension
    Call it HTTP Compression
    Point it to c:\windows\system32\inetsrv\gzip.dll
    Check the Set status checkbox so that it is enabled (Allowed)
    Enable Direct Metabase Edit

    Download IIS 6.0 Resource Kit from Microsoft it can help you administer, secure, and manage IIS. It also lets you edit and save changes to the Metabase.xml file:

    N

     

    Settings for LM\w3svc\Filters\Compression\deflate

    Make sure the values here are correct. HcDynamicCompressionLevel has a default value of 0. Basically this means at if you did everything else right, the compression for dynamic contact is at the lowest level. The valid range for this is from 0 to 10. I had the opportunity of receiving an internal testing summary from Chris Adams from Microsoft regarding the compression level vs- CPU usage which showed that the CPU needed for levels 0 9 is fairly low but for level 10 it hits the roof. Yet the compression for level 9 is nearly as good as level 10. I write all this to say that I recommend level 9 so make sure to change HcDynamicCompressionLevel to 9. Do this for both deflate and gzip.

    HcFileExtensions Properties

      1. htm
      2. html
      3. aspx
      4. asmx
      5. js
      6. css
      7. ashx
      8. axd
      9. txt

    HcScriptFileExtensions Properties

      1. asp
      2. dll
      3. aspx
      4. asmx
      5. js
      6. css
      7. ashx
      8. axd
      9. exe

     

    Settings for LM\w3svc\Filters\Compression\gzip

    Use the same settings for File Extensions as in the previous section (deflate)

    Make sure the values here are correct. HcDynamicCompressionLevel has a default value of 0. Basically this means at if you did everything else right, the compression for dynamic contact is at the lowest level. The valid range for this is from 0 to 10. I had the opportunity of receiving an internal testing summary from Chris Adams from Microsoft regarding the compression level vs- CPU usage which showed that the CPU needed for levels 0 9 is fairly low but for level 10 it hits the roof. Yet the compression for level 9 is nearly as good as level 10. I write all this to say that I recommend level 9 so make sure to change HcDynamicCompressionLevel to 9. Do this for both deflate and gzip.

    After these changes have been made, close and restart IIS.

    Note - this procedure must be repeated on all web servers in the same cluster.