Search code examples
iisgziphttp-compression

When do I use gzip compression with dynamic pages?


As a general rule, when is enabling gzip compression for IIS a good idea? Take for example the following cases:

  1. Static Page
  2. ASP Page that has many static elements and a few dynamic elements
  3. ASP Page that has a few static elements and many dynamic elements
  4. ASP Page that is completely dynamic
  5. A Wordpress installation on IIS

Obviously you can have a mix of static/dynamic pages. What are some general rules to make a decision? If a page contains ANY dynamic content is it bad to compress it?

In my case I have two sites. One site is mostly static with a few pages that are generated dynamically by ASP. The second site is a Wordpress installation. For case one I feel comfortable saying compression is the way to go. For Wordpress I am not so sure.

I am having trouble wrapping my head around what happens with dynamic content. Say I have a page that contains a dynamic element that displays the date and time. Every time someone visited the time would change. Would compression be silly?


Solution

  • While it is possible to configure compressed content to be cached, many sites compress everything on the fly even if it is static content. You have to decide whether the bandwidth savings from compression are worth the CPU load of compressing on-the-fly, but in most cases, the user's experience is impacted much more by download time than by processing time, and so the benefit will come down on the side of compressing. Whether the content is dynamic isn't really relevant in that case.