HTTP compression is a capability that is built into web servers and web
browsers to make better use of available bandwidth, and provide faster
transmission speeds between both.
HTTP data is compressed
before it is sent from the server: compliant browsers will announce what
methods are supported to the server before downloading the correct format;
unsupported browsers will download uncompressed data so enabling HTTP
compression does not prevent older browsers from viewing the Html content.
Benefits of HTTP Compression:
Let’s say we are working
with a 100KByte Html page.
This page is hosted on our clients website and when it’s served to a browser,
the browser downloads 100BKytes.
If our upstream bandwidth is limited to 100Kbytes a second, this means that we
can serve 1 of these pages to a 1 browser every second.
If we use HTTP Compression,
we can compress the page to 30Kbytes and what this means is that we can now
serve 3 compressed pages to three browsers in 1 second.
Not only that, users downloading compressed Html will experience a
smoother/faster user experience.
The final benefit is that
your monthly bandwidth costs are reduced by around 60%.
When configuring HTTP
Compression on any server one needs to keep in mind that compressing anything
adds to the server load.
If the server is already running at a high average load then it is not
recommended to enable HTTP compression.
After enabling compression
one must monitor the server and if the load and depending on the server OS you
are running, configure the HTTP Compression settings to adjust to the load.
In Windows Server 2003 you can fine tune your compression settings so that at
times of high load the server will stop serving compressed content.
Types of HTTP Compression:
There are two forms of compression;
Static and Dynamic.
Static compression is the compression of static web pages such as .Html, .Js
and cascading style sheets.
Static compression only
compresses static content once and then it moves the statically compressed file
to a cache folder and serves it from there.
Even if your server is under high load, compressing static content will not
increase your server load as it just compresses static content once.
Dynamic compression is the
compression of dynamically generated web pages such as those served by ASP, PHP
Unlike static compression,
dynamic compression needs to compress each and every page each time the page is
served; hence dynamic compression can increase the server load, especially on
very busy servers.
Configuring HTTP Compression on Windows
Microsoft never completed their GUI for IIS to enable dynamic compression.
Microsoft instead requires you to edit the IIS meta-base file which is rather
dangerous for the average user to do.
Fortunately there is a good tool by a company called Port80 that I’ve used with
success that allows the configuration of Windows 2003 Server.
The name of the tool is
ZipEnable for IIS.
This tool allows you to configure static and dynamic compression site server
wide or on the website level.
Further you can set the compression strength and define a CPU load value where
compression will no longer be performed along with a host of other features.
Configuring HTTP Compression on Windows
HTTP Compression support
was adequately integrated into a GUI within Windows Server 2008.
To enable support for dynamic and static compression, do the following:
Once the HTTP compression features have been installed you can now open IIS
Manager (Start à
Run à inetmgr) and browse
to the website you have decided to test HTTP compression on.
Select your website and double click the Compression icon under the IIS
The Compression page will display check boxes next to Static and Dynamic
compression. Check both these boxes and click apply.
Finally, to test if your web pages are being served as compressed test them on
this webpage http://www.port80software.com/products/zipenable/compresscheck.asp
This website will read the
HTTP headers and determine if your webpage is compressed and give you the exact
compressed and uncompressed HTML values.
Page rendered at Sunday, 23 September 2018 00:12:29 (South Africa Standard Time, UTC+02:00)
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.