Improve performance of Apache HTTPD by Expires

Apache HTTPD is one of the most popular web server in this world. It may handle wide range from light load to heavy load. Another popular one is lighttpd. There are so many benchmarks to compare these two softwares. For lighttpd, lighttpd is the best. In other view, Apache HTTPD is the best for themselves. These benchmarks are just to measure performance under heavy load. Another approach to improve performance is to reduce load.

The approach is to help web browser to realize about validity of each object obtained from such a web server. In other words, web server should specify appropriate expiration time in the response. Most web server supports this feature (at least Apache HTTPD does).

If you are still blind how to specify expiration time properly, you might try to read this article.


    ExpiresActive On
    ExpiresByType text/html "modification plus 3 days"
    ExpiresByType text/xml  "modification plus 3 days"
    ExpiresByType image/gif "access plus 4 weeks"
    ExpiresByType image/jpg "access plus 4 weeks"
    ExpiresByType image/png "access plus 4 weeks"
    ExpiresByType video/quicktime "access plus 2 months"
    ExpiresByType audio/mpeg "access plus 2 months"
    ExpiresByType application/pdf "modification plus 2 months"
    ExpiresByType application/ps "modification plus 2 months"
    ExpiresByType application/xml "modification plus 2 weeks"

Another example is the default setting in Drupal.


  ExpiresByType text/html A1

A1 means access plus 1 second. In other words, all dynamic pages generated by Drupal are forced to expire one second after access time. This is just to make sure visitors got the up-to-date page and all caching mechanisms are usually done in Drupal itself.

Tags: , , ,

Post new comment