Caching and Compression


The fastest way to serve content is to not serve it! This can be achieved by using appropriate HTTP headers that instruct clients and proxies of the validity in time of the requested resources. In this way, some resources that appear in multiple pages but don't change frequently, such as logos or navigation buttons, are transmitted only once for a certain period of time.

Additionally, you can use mod_cache (described in Chapter 10) to cache dynamic content so that it doesn't need to be created for every request. This is potentially a big performance boost because dynamic content usually requires accessing databases, processing templates, and so on, which can take significant resources.

Another way to reduce the load on the servers is to reduce the amount of data being transferred to the client. This, in turn, makes your clients' website access faster, especially for those over slow links. To help with this, you can reduce the number and size of your images. You can automate part of this process using the ImageMagick command-line tools (http://www.imagemagick.org). Additionally, you can compress big downloadable files or even static HTML files and use content negotiation, as described in previous chapters. Chapter 11 explains how to use the mod_deflate filtering module to compress HTML content. This can be useful if CPU power is available and clients are connecting over slow links. The content will be delivered faster and the process will be free sooner to answer additional requests.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net