Changes to compression in IIS7

Posted: Jun 13, 2006  34 comments  

Average Rating

Tags
Compression

Compression module provides IIS the capability to serve compressed responses to compression enabled clients. Clients which can accept compressed responses send Accept-Encoding header indicating compression schemes they can handle. If IIS can compress the response using a compression scheme which client can understand, IIS will send a compressed response with Content-Encoding response header indicating the scheme which was used to compress the response. Read more ...

View the original post

Comments

  1. Chintan Parmar
    June 20, 2007

    Hello,

    This is nice to know, for IIS7 about the compression. But I have one question for this, if you could provide me an answer that would be greate, and I really appriciate that.

    i tried to use http compresion on IIS7, but somehow, i guess that dose not give me any result.

    I tried to access my website using the folllwing webtools.

    www.port80software.com/.../compresscheck.asp

    which always shows me, Compression Status : notcompress [:(]

    So, i guess something more we need to do httpCompression in IIS7.

    Please look into the following what i wrote in my web.config file.

    <system.webServer>

    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">

    <dynamicTypes>

                   <add mimeType="text/*" enabled="true" />

                   <add mimeType="message/*" enabled="true" />

                   <add mimeType="application/x-javascript" enabled="true" />

                   <add mimeType="*/*" enabled="true" />

               </dynamicTypes>

               <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />

    </httpCompression>

           <modules>

               <add name="URLRewriter" type="ILink.Beonit.HTTPModules.URLRewriter, ILink.Beonit.HttpModules.URLRewriter" preCondition="managedHandler" />

               <add name="Authentication" type="ILink.Beonit.HTTPModules.Authentication, ILink.Beonit.HttpModules.Authentication" preCondition="managedHandler" />

               <add name="ModuleRewriter" type="ILink.Beonit.HTTPModules.ModuleRewriter,ILink.Beonit.HTTPModules.URLRewriter" preCondition="managedHandler" />

               <add name="ImageServer" type="ILink.Beonit.HTTPModules.ImageServer, ILink.Beonit.HttpModules.ImageServer" preCondition="managedHandler" />

           </modules>

           <handlers>

               <add name="ajax/*.ashx_POST,GET" path="ajax/*.ashx" verb="POST,GET" type="Ajax.PageHandlerFactory, Ajax" preCondition="integratedMode,runtimeVersionv2.0" />

           </handlers>

           <validation validateIntegratedModeConfiguration="false" />

           <httpRedirect enabled="false" destination="http://www.beonit.net" />

           <urlCompression doDynamicCompression="true">

    </urlCompression>

       </system.webServer>

    I am awaiting for your reply

  2. ksingla
    June 24, 2007

    Chintan,

    Are you sure you wrote httpCompression section properties in web.config? HttpCompression section is defined AppHostOnly in applicationHost.config which prevents you from setting its properties in web.config. Compression module only reads server level properties from applicationHost.config. If you allowed httpCompression section by modifying section definition in applicationHost.config, that might be a problem. See if this is the problem.

    Kanwal

  3. Vlad
    August 2, 2007

    When you say "the main thread", do you mean a request thread, or the main IIS service thread?

    One compression thread per app pool, or many?

  4. ksingla
    August 2, 2007

    Vlad,

    By main thread, I meant request thread. There is no dedicated thread to do compression in IIS7 and so there can be many threads in a worker process doing compression.

    Kanwal

  5. Vlad
    August 3, 2007

    Thank you very much for the information, it is very helpful to understand how much it has changed from IIS 6.0!

  6. mike
    November 9, 2007

    Javascript won't work on a webpage in iis7 ?

  7. spenser
    November 11, 2007

    I think that removing the various knobs is a mistake. Setting a good default value and leaving the knobs available would be my preference.

    As for:

    HcPriority is removed as scheme to use when multiple ones appear in Accept-Encoding header of request is picked depending on scheme which is appear first in Accept-Encoding header (assuming no q factor). This is as per HTTP specs.

    It may be true that the client can specify a preference, and the preference is in presentation order, but, the server administrator may have a different preference. That is why it is stated as a preference order. And yes, there are good reasons for picking one over the other in specific circumstances.

  8. George
    November 24, 2007

    In IIS6, I can add *.jsp as a file type for dynamic content compression.

    For IIS7, I do not need to worry about the file type for dynamic, thery are all enabled, right?

    Thanks,

  9. ksingla
    November 27, 2007

    George,

    In IIS7, you can enable/disable compression based on mime-types. So instead of adding *.jsp, you need to enable dynamic compression for its mime-type by editing configuration in system.webServer/httpCompression section under dynamicTypes element. If you want to enable dynamic compression for all mime types, you can allow dynamic compression for */* mime-type. By default, dynamic compression is enabled for text/* and message/* mimetypes and not for all (mime-type */* has enabled="false").

    Kanwal

  10. ksingla
    November 27, 2007

    Mike,

    I am not sure why you think that javascript won't work on a webpage in IIS7. Javascript will work just fine on IIS7. Javascript is just another file and we send it across on http. Its http clients responsibility to request the files and interpret them all correctly.

    Kanwal

  11. ksingla
    November 27, 2007

    Spenser,

    Other than HcPriority and HcFilesDeletedPerDiskFree , other knobs were deleted because they pretty much don't make any sense given the design changes. I agree than scheme priority can be useful in some cases but we choose to stay compliant with http specs instead.

    Kanwal

  12. burçlar
    December 11, 2007

    Astroloji, günlük burçlar, burç uyumları, yükselen burçlar, aşk ölçer, haftalık burçlar, aylık burçlar, aşk falı testi, burç uyumu.

  13. carsamba
    January 10, 2008

    Danke

  14. carsamba
    January 10, 2008

    Javascript won't work on a webpage in iis7 ?

  15. ksingla
    January 10, 2008

    Hi carsamba,

    Javascript will work perfectly in IIS7. I am not sure why you got the impression that javascript won't work.

    Kanwal

  16. Microsoft.com Operations
    January 18, 2008

    Most operational folk are heads down either fixing issues, implementing new changes, or preparing environments

  17. gunok
    August 10, 2008

    hi ;

    We have a very busy server and IIS Compression disables mostly in daytime. We want it to be open what ever it costs. Because of not being want to consuma that much bandwith.

    We even did make

    dynamicCompressionDisableCpuUsage="99"                                  dynamicCompressionEnableCpuUsage="1">

    But how can I complettly shut of the disabling system ?

    Thank you very much

  18. ksingla
    August 19, 2008

    Hi gunok,

    There is no separate knob to completely shutoff the disabling system. If you change dynamicCompressionDisableCpuUsage and staticCompressionDisableCpuUsage to 100, that will effectively turn this system off because cpu usage will never be more than 100%. I don't think you need to set dynamicCompressionEnableCpuUsage and staticCompressionEnableCpuUsage but you can set them to 99/100 telling the system to enable it back if usage falls below 99%/100%.

    Thanks,

    Kj

  19. Noticias
    August 29, 2008

    Para utilizar mas eficientemente el ancho de banda disponible, usted puede activar la compresi&oacute;n

  20. Anonymous
    September 13, 2008

    Have you seen an situation where event ID 2264 is logged hourly?

    "The directory specified for caching compressed content C:\inetpub\temp\IIS Temporary Compressed Files\DefaultAppPool is invalid.  Static compression is being disabled"

    can you explain how this might be related to any changes in IIS7?

  21. how to enable the compression on IIS7 « nilleb’s tech blog
    October 4, 2008

    Pingback from  how to enable the compression on IIS7 &laquo; nilleb&#8217;s tech blog

  22. Anonymous
    October 22, 2008

    Hi,

    I read that IIS6 does not support inbound HTTP compression. Is is true and is there a chance that inbound compression is supported by IIS7?

    Best regards,

    Yves Van Dooren.

  23. ksingla
    October 23, 2008

    Hi Yves Van Dooren,

    Yes, its true that IIS6 doesn't support inbound http compression and same is true for IIS7. I am not aware of any plans to support that in next release as well. I will follow-up on this request in the team so that we can evaluate doing this in a future release.

    Thanks,

    Kanwal

  24. elk5432
    November 6, 2008

    Kanwal,

    Is it reasonable to hope for whitespace compression and normalization (i.e. minify code.google.com/.../minify) in new releases of iis? There is 3rd party software that can do this through ISAPI filters for IIS5/6.

    We've been 10-15% improvements in bandwidth from minifying on our clusters.

    Eugene

  25. ksingla
    December 9, 2008

    Hi Eugene,

    Right now this is not planned for next release of IIS7. I am going to follow up in the team and see if we should do something similar in compression module. I will reply again when there is a decision on this.

    Thanks for suggesting this feature.

    Kanwal

  26. javascript performance tuning exercise- jslint+jsmin+Yslow+gzip on IIS7 « Yet another blog again
    December 19, 2008

    Pingback from  javascript performance tuning exercise- jslint+jsmin+Yslow+gzip on IIS7 &laquo; Yet another blog again

  27. Perf World
    January 27, 2009

    GZip/Deflate compression will compress the response payload from the IIS web server to the browser. Pages

  28. Anonymous
    February 11, 2009

    Thanks for this fresh information; I was looking for a convenient place for compressing heavy video file. Besides these, I have found another place to compress and decompress all sorts of files. That is www.krunchit.net where you can zip or unzip ten files online altogether.

  29. Anonymous
    February 12, 2009

    Thanks for this fresh information; I was looking for a convenient place for compressing heavy video file. Besides these, I have found another place to compress and decompress all sorts of files. That is http://www.krunchit.net where you can zip or unzip ten files online altogether.

  30. Anonymous
    February 16, 2009

    I think what people are getting at when they say it doesn't work with Javascript is that by default the applicationHost.config has the following line in the static HTMLCompression section:

    <add mimeType="application/javascript" enabled="true" />

    However in the same document IIS is configured to give .js files to the mimeType "application/x-javascript", so js files will not be zipped by default. Adding the following line gets it all working.

    <add mimeType="application/x-javascript" enabled="true" />

    Hope this saves someone else a little time

  31. Anonymous
    February 18, 2009

    A Better HTTP Compression Solution

    Here is a better solution that works with JavaScript and also compatible and with AJAX enabled content: micromighty.com/.../HTTP_Compression_Module.aspx

    This HTTP Compression module uses configureable MIME types and other features that are not being offered by any other http compression software, it is also being configured through the Web.config and not on IIS,

    See how flexible it can be: micromighty.com/.../HTTPCompressionModule.aspx

  32. Scott Forsyth's Blog
    February 23, 2009

    If you haven't properly leveraged compression in IIS, you're missing out on a lot! Compression is a trade

  33. ksingla
    May 6, 2009

    Hi Avinash,

    By “you don’t have access to IIS”, I understand you don’t have administrator access to IIS and can only change configuration in web.config. Is this correct?

    If yes, then no you can’t enable compression for “.config” files. Only administrator can enable compression for “.config” files by adding that to httpCompression/staticTypes list. You can only control if you want to enable or disable compression completely by setting urlCompression/doStaticCompression property.

    Thanks,

    Kanwal

  34. Anonymous
    February 8, 2010

    Hi Kanwal,

    There are a few things I am unable to figure out how to do.

    1) Enable compression of */* mime type for my application only, not for the entire IIS.

    2) The whole reason I need */* is that WCF uses a mime type of multipart/related; type="application/xop+xml"

    In summary, my question is.. how to enable http compression for WCF-based services, and only for my web app ? Would be great if it could be done in web.config instead of applicationHost.config, but that is a bonus.

    Thanks,

    Ryan

Submit a Comment