Optimizing Web Servers for Wireless

So you have a Web site and are interested in providing content for wireless devices? Did you know that HTML can be compressed before it is sent, making your Web site faster?

Well, your Website can be faster for free! Microsoft has implemented the HTML 1.1 protocol (www.w3.org/Protocols/rfc2616/rfc2616.html), including support for gzip and deflate formats, in the Pocket PC 2000 and 2002 and the Handheld PC 2000, and in desktop Web browsers such as Internet Explorer 4 or later. Other Web browsers such as Netscape Navigator 4 or later and Lynx 2.6 or later also support HTML compression. The Pocket PC and Handheld PC Web browsers report "ACCEPT_ENCODING: gzip, deflate," as do most modern browsers. If you implement HTML compression, your Web site HTML will be compressed 50% or more! Now that's a difference that your wireless users will recognize in the reduced cost and time of their GPRS, 1xRTT, or dialup connections.

By turning on HTML compression, you will allow your Web site to serve up both compressed and uncompressed Web pages, as well as HTML 1.0 and 1.1 protocol Web pages, depending on what the Web browser supports. This means that if you implement compression on your Web server, users of older Handheld PCs or Palm-size PCs will still be able to view your Web site like Pocket PC users.

Testing your Web server and Web browser

To cut the HTML data sent and received in half, you need to implement gzip or deflate encoding of your content. You can test your Web site to see whether your HTML is compressed by visiting http://leknor.com/code/gziped.php and entering your Web site's URL. You will see a report of the headers for the HTTP connection your Web server is providing. If your Web site does not implement gzip, you will see a table of the improvements that your users would see for specific connection speeds if you were to implement gzip compression. You can also test your Web browser to see if it supports compressed HTML at www.schroepl.net/cgi-bin/http_trace.pl.

In order to change the settings in the Web server to support compression, you must have access to the Web server's configuration. If you do not have control over the configuration of your Web server you will need to contact your ISP to change these settings. Your ISP should be interested in enabling this so that your Web site bandwidth is reduced.

One caveat for using HTML compression is that it requires your Web site to use more CPU power to compress the files. So you should monitor your CPU usage before and after installing a compression solution on your Web server.

Compatibility with other optimizations

HTML compression can be implemented in addition to other optimizations on your Web server. For example, you can use a PHP optimizer like Zend Optimizer (www.zend.com) or PHP Accelerator (www.php-acelerator.co.uk). A good description of how to optimize PHP is "A HOW TO on Optimizing PHP" (http://phplens.com/lens/php-book/optimizing-debugging-php.php). You can speed things up even more by enabling query caching in MySQL (http://forum.rackshack.net/showthread.php?s=ed9f6c2249705b9/cbcdc77ae587a12ae&threadid=19872). HTML compression works fine with Server-Side Includes (SSI), PHP, FrontPage Extensions and CGI scripts. While HTML compression does not affect header compression of TCP/IP, it does reduce the payload compression that some TCP/IP dialup connections offer. However, the overall size of the TCP/IP content sent in this situation is no larger than if the compression were not enabled.

Configuring the Apache Web server