What is the optimal GZIP compression setting for IIS?

You can install HcDynamicCompressionLevel anywhere from 0 to 10. I heard that 10 is bad (high CPU usage), but which magic number works best?

+3
source share
5 answers

I found that setting it to 8 gives a pretty good compression speed without taking the server too much. This will depend on the load and specification of your server.

0
source

Settings from 5 to 9 for dynamic DO compression actually clog the processor load. Static compression occurs only once (until the file is cached), and you can set high-level static compression.

This in-depth article recommends 4 for dynamic compression and 7 to 9 for static compression . The article confirms this recommendation with information that you can read and decide on your own.

http://weblogs.asp.net/owscott/archive/2009/02/22/iis-7-compression-good-bad-how-much.aspx

Small dynamic pages can benefit from higher dynamic compression settings as CPU utilization grows with large files. With a size of about 200 KB, you might want to consider a lower dynamic setting for pages. Also note that high dynamic compression settings increase the time to receive the first bytes from each request per page. These factors support the use of a more restrained setting of 4 for dynamic compression.

Again, static resources can use a high parameter, since only the first request affects the CPU load and client timeout. However, if you serve many large static resources, static compression will also not pay off, because your cache will fill up and run to retrieve resources; thus, compressed resources will not receive multiple times from the cache.

NOTE. No setting "10".

Two more things to consider:

The httpCompression element in your .config files has settings that disable compression when the processor load is too high:

 dynamicCompressionDisableCpuUsage="90" dynamicCompressionEnableCpuUsage="80" staticCompressionDisableCpuUsage="100" staticCompressionEnableCpuUsage="80" 

The EnableCpuUsage parameter re-enables compression when the CPU load drops below the specified value.

Another option disables compression for small files:

 minFileSizeForComp="2700" 

IIS 7.5 increased the minimum file size for default compression by 256 bytes in IIS 7.0 to the default value of up to 2700 bytes after some compressed files were larger than the original. I don’t know if 2,700 bytes are better, but since the IP packet can be approximately 1,400 bytes, this option will prevent files from being compressed in less than two packets. I would like to conduct real tests or read expert advice before arbitrarily challenging Microsoft's decision to raise this setting.

+3
source

10 was bad when processors are two orders of magnitude slower than now. The gzip algorithm is pretty fast, since compression algorithms go on these days, so I would set it to 10 and see what happens.

+2
source

It seems to me that this will really depend on your situation. If you serve a large number of large files and have spare processor power, then a higher number will be better. However, since you have more concurrent connections, smaller files, and a less powerful processor, a smaller number is better.

0
source

The company I work for has enabled dynamic compression for ASPX and dynamically generated javascript / css and pages seem to take longer to load. We tried to set the compression level to 1 and max. cpu 90%, but still worse than without compression. My

0
source

All Articles