Using compression on IIS servers? Yes or no?

Well…in the very beginning, my answer is pretty much simple : yes AND no!  Why you ask?  Just keep reading…

Compression, regardless if its the compression of static or dynamic content is using CPU – that is a fact we can all agree upon.

Lets say compression is a tradeoff – CPU for bandwidth..use more cpu to “burn” less bandwidth.

The big question here is how to decide if you will benefit from turning on compression or not.

Most of us have “multi-purpose” servers which run various roles at the same time ( database server ( MYSQL , MSSQL, etc…) , mail server, web server, etc.. and all of those services are spending a certain amount of CPU time.

By turning on the compression, you will automatically “lose” some CPU time which could have been used for faster execution of some database queries i.e…

This is the key problem in our case. Is your machine powerfull enough to handle all the services it is already running + compression? Because in the end, you could end up with an even slower server!!!

If you have a small server ( 1 x quad core cpu, 4-8 gb ram ) which is under heavy or moderate load and you want your applications to be “jumpy” ( i.e : fast editing of some articles in your favourite CMS system ),  or you have lots of queries on your database service: DONT use compression, save your CPU time.  If you have some CPU time to spare,  turn on compression of static content which doesn’t change a lot or only needs to be downloaded every once in a while ( browser cache expires )

In case you have a big machine ( 2x quad core nehalems, 24 gb ram, 4x enterprise level hdd’s with hw raid controller, etc…)  and you have CPU time to spare, by all means, turn on the compression of both static and dynamic content. You will notice great improvements on your bandwidth costs 🙂

In my experience, the biggest bottleneck on 99% of the server is the disk system. Ofcourse, in my case we are talking about some small RAIDs with 4-8 disks.

Great example of that case are these two pictures:

CPU usage on a 2xQUAD core server with 16 gb of RAM.

As we can see, the server peaks out at 28% of cpu usage, which means it has lots of CPU time to spare for compression.

However, lets have a look at its disk system:

As we can see on the graph, average DISK FREE TIME is 64%, which is a bit low for my personal taste. I would be much more comfortable that this number is around 70 -75% .

This machine would definatelly benefit from turning on compression, since it has lots of CPU time to spare.

But I own a small server…is there any hope for me???


One great feature in IIS 7 and IIS 7.5 is that it  offers CPU roll-off function.  When CPU usage goes  above certain level you set,  IIS server will stop compression and when usage drops below the level you have set up, it will start compressing content again.  This function is controlled by the staticCompressionEnableCpuUsage and dynamicCompressionDisableCpuUsage attributes.

For the owners of smaller machines, this function is just AWESOME! It will save you from unpleasant suprises like getting a call at 2-3 AM with a complaint that the SQL server is very sloooow.

In the end; you be the judge. Will you turn on compression on your server or not? Let me know…

One thought on “Using compression on IIS servers? Yes or no?

Leave a Comment

Your email address will not be published. Required fields are marked *