Web Performance: Data compression with IIS 7.0

18 בפברואר 2009

תגיות: , , , ,
2 תגובות

In one of my previous posts I’ve described a way to enable data compression in IIS 6.0 server. It was not a straightforward mission, but in IIS 7.0 the situation was CHANGED, and I mean it  – it’s a totally a different story.

Enable basic data compression

In IIS 7.0 basic data compression can be enabled by checking two checkboxes on configuration panel at IIS 7.0 management tool, without any need in changing configuration files. It can be enabled at each level of server hierarchy (Common server level, Website, web folder etc.) – meaning, data compression definition can vary between each folder in IIS server.

Data compression can be enabled by clicking on “Compression” icon in properties of IIS root node.

 

 image

Opened dialog contains standard data configuration. I’ve explained those properties in my previous post about IIS 6.0 data compression, it was not changed in IIS 7.0.

image

If “Compression” icon is clicked on any of IIS’s root node sub-levels, this dialog will be shown.

image

Customizing data compression

Data compression at IIS 7.0 server is highly customizable and, unlike IIS 6.0 server, can vary in each sub level of IIS server.

Files for customization:

In each of those files httpCompression XML node can be located for data compression customization.

<httpCompression    
    cacheControlHeader="string"    
    directory="\subdirectory\file"    
    doDiskSpaceLimiting="True|False"    
    dynamicCompressionDisableCpuUsage="integer"    
    dynamicCompressionEnableCpuUsage="integer"    
    expiresHeader="date and time"    
    maxDiskSpaceUsage="integer"    
    minFileSizeForComp="integer"    
    noCompressionForHttp10="True|False"    
    noCompressionForProxies="True|False"    
    noCompressionForRange="True|False"    
    sendCacheHeaders="True|False"    
    staticCompressionDisableCpuUsage="integer"    
    staticCompressionEnableCpuUsage="integer"
>      
    <scheme    
        dll="name of compression dll"    
        doDynamicCompression="True|False"    
        doStaticCompression=" True|False "    
        dynamicCompressionLevel="integer"    
        name="name of compression scheme"       
        staticCompressionLevel="integer"
    >
       <remove name="name of compression scheme" />
       <clear />
    <scheme/>   
    <dynamicTypes>...</dynamicTypes>       
    <staticTypes>...</staticTypes>
</httpCompression>

 

Tip:

Web.config file is most convenient place to configure data compression rate for application. This way there no need to configure settings on each target IIS server during deployment process.

By default “dynamicCompressionLevel” value is 0 and “staticCompressionLevel” is 7. Those values might be not optimal for your system. Web.config would be a good  place to change them. In some cases there is a need to define custom file types for a compression. All those can be solved by updating httpCompression node.

Here is the list of default values you should be familiar with:

dynamicCompressionDisableCpuUsage 90%
dynamicCompressionEnableCpuUsage 50%
staticCompressionDisableCpuUsage 100%
staticCompressionEnableCpuUsage 50%
dynamicCompressionLevel 0
staticCompressionLevel 7

Data compression throttling

IIS 7.0 opens for developers an ability to apply advanced logic into data compression mechanism. Besides standard compression level for static and dynamic files there is data compression throttling depending on current CPU ratio. This makes possible to define clear boundaries for a compression to reduce performance impact on running web applications.

After performing all the changes above – IIS server must be restarted to apply all those changes.

To check performance improvements use Fiddler or YSlow to monitor HTTP traffic.

IIS 7.0 version delivers highly flexible model for data compression helping developers to upgrade application’s performance without changing code.

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. (*) שדות חובה מסומנים

2 תגובות

  1. alikl18 בפברואר 2009 ב 23:47

    HA!
    Very cool!
    I like your thorough posts on Performance!
    Good job – keep posting, please. I enjoy it a lot

    להגיב
  2. Maor David-Pur18 בפברואר 2009 ב 23:53

    Post – not beer….I got the message

    להגיב