Web Performance, Branding, and Social Media
How much improvement can you see with compression? The difference in measured download times on a very lightly loaded server indicates that the time to download the Base Page (the initial HTML file) improved by between 1.3 and 1.6 seconds across a very slow connection when compression was used.

Base Page Performance
There is a slightly slower time for the server to respond to a client requesting a compressed page. Measurements show that the median response time for the server averaged 0.23 seconds for the uncompressed page and 0.27 seconds for the compressed page. However, most Web server administrators should be willing to accept a 0.04 increase in response time to achieve a 1.5 second improvement in file transfer time.

First Byte Performance
Web pages are not completely HTML. How do improved HTML (and CSS) download times affect overall performance? The graph below shows that overall download times for the test page were 1 to 1.5 seconds better when the HTML files were compressed.

Total Page Performance
To further emphasize the value of compression, I ran a test on a Web server to see what the average compression ratio would be when requesting a very large number of files. As well, I wanted to determine what the affect on server response time would be when requesting large numbers of compressed files simultaneously. There were 1952 HTML files in the test directory and I checked the results using CURL across my local LAN.[1]
| Uncompressed | Compressed | ||
| First Byte | |||
| Mean | 0.091 | 0.084 | |
| Median | 0.030 | 0.036 | |
| Total Time | |||
| Mean | 0.280 | 0.128 | |
| Median | 0.173 | 0.079 | |
| Bytes per Page | |||
| Mean | 6349 | 2416 | |
| Median | 3750 | 1543 | |
| Total Bytes | 12392318 | 4716160 |
| Uncompressed | Compressed | ||
| First Byte | |||
| Mean | 0.044 | 0.046 | |
| Median | 0.028 | 0.031 | |
| Total Time | |||
| Mean | 0.241 | 0.107 | |
| Median | 0.169 | 0.050 | |
| Bytes per Page | |||
| Mean | 6349 | 2418 | |
| Median | 3750 | 1544 | |
| Total Bytes | 12392318 | 4720735 |
| mod_gzip | mod_deflate | |
| Average Compression | 0.433 | 0.438 |
| Median Compression | 0.427 | 0.427 |
|
Average Compression by File Size
|
With a few simple commands, and a little bit of configuration, an Apache Web server can be configured to deliver a large amount of content in a compressed format. These benefits are not simply limited to static pages; dynamic pages generated by PHP and other dynamic content generators can be compressed by using the Apache compression modules. When added other performance tuning mechanisms and appropriate server-side caching rules, these modules can substantially reduce the bandwidth for a very low cost.
[1] The files were the top level HTML files from the Linux Documentation Project. They were installed on an Apache 1.3.27 server running mod_gzip and an Apache 2.0.44 server using mod_deflate. Minimum file size was 80 bytes and maximum file size was 99419 bytes.
[2] mod_deflate for Apache/2.0.44 and earlier comes with the compression ratio set for Best Speed, not Best Compression. This configuration can be modified using the tips found here; and starting with Apache/2.0.45, there will be a configuration directive that will allow admins to configure the compression ratio that they want.
In this example, the compression ratio was set to Level 6.
[3] mod_deflate does not have a lower bound for file size, so it attempts to compress files that are too small to benefit from compression. This results in files smaller than approximately 120 bytes becoming larger when processed by mod_deflate.
Stephen Pierzchala is one of a cadre of crazy Canucks living in the United States. A 10-year veteran of the Web performance field, Stephen also writes on topics as diverse as branding and reputation, bipolar, and Web technologies.