Monday, 19 April 2010

HTTP Compression:

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%.

Server Impact:

 

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 enabled servers.

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 2003 Server:

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 2008 Server:

 

HTTP Compression support was adequately integrated into a GUI within Windows Server 2008.


To enable support for dynamic and static compression, do the following:

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.
  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).
  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.
  4. On the Select Role Services page of the Add Role Services Wizard, select Dynamic Content Compression if you want to install dynamic compression and Static Content Compression if you want to install static compression, and then click Next.
  1. On the Confirm Installation Selections page, click Install.
  2. On the Results page, click Close.


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 heading.
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.






 

posted on Monday, 19 April 2010 01:05:00 (South Africa Standard Time, UTC+02:00)  #    Comments [0] Trackback
Related posts:
AppFabric, Static Content Not Loading
Quick guide for migrating IIS6 applications to IIS7
IIS6 Native HTTP Compression Tutorial
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):