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.
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.
If “Compression” icon is clicked on any of IIS’s root node sub-levels, this dialog will be shown.
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:
- ApplicationHost.config – is global IIS 7.0 configuration file, located at %windir%\system32\inetsrv\config
In each of those files httpCompression XML node can be located for data compression customization.
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:
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.
IIS 7.0 version delivers highly flexible model for data compression helping developers to upgrade application’s performance without changing code.