RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


A Guide to Caching and Compression for High Performance Web Applications : Page 3

Understanding HTTP's cache headers and compression capabilities is a prerequisite for building high-performance web applications.


A Do-It-Yourself Approach

As suggested earlier, the do-it-yourself (DIY) approach is not always the easiest path. In fact, entire CDN companies exist that provide products and solutions to meet various needs. However, if you need to develop a product in-house, one potential aid is Squid. Squid is used as a component in numerous products and by many ISPs. For example, in a Java application, Squid can be used as a proxy to a Tomcat server. Squid provides more than just HTTP caching, but a full discussion of its capabilities is outside the scope of this article. You can see another example of using Squid at Wikimedia.

HTTP Compression

Caching is only one approach to improve web application performance; compression is another key element. HTTP compression compresses content before it gets sent to the client. Compression capabilities are built into both browsers and servers, and implementation requires both to work hand in hand. When your servers deliver compressed content that can be uncompressed at the browser level, you can save valuable bandwidth, reduce costs, and improve response times.

Browsers advertise their support using the header accept-encoding—typically with a value of gzip. Servers respond with a content-encoding header that specifies the encoding of the response data. For example, a server would include a content-encoding header with a value of gzip if the response was compressed using the gzip format.

Servers examine the MIME type of the response, compressing only those types that can benefit from compression techniques, such as text files, HTML, and PDF files. MIME types that don't gain much benefit from compression include image formats such as gif files (which are already in a compressed format), some video files, and other pre-compressed binary file formats.

Author's Note: If you implement caching, any proxy servers should support the same compression as the origin servers.

Overall, a combination of caching and compression can provide huge cost and performance benefits, consequently improving the scalability of your applications.

Puneet M. Sangal, Practice Manager, has 12 years' experience in global management, project management, selling services, consulting, and software development in Europe, Pacific, India, and the U.S. He has studied executive management at IIM Calcutta, and holds an MS from Northeastern University in Boston, MA, and a BE from BIT Ranchi.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date