Very recently, I was asked by few of my colleague to performance tune a website, which its web master found too slow to handle requests. The site was already running on a dual quad core processor with 8 GB of RAM. And, the apache configuration was at its maximum to get rocking performance from the server. Still I found the site too slow. The site was getting hits in the order of 200, 000 per hour.

The solution I found very suitable for the site was mod_cache. mod_cache has been around for some time now and its for increasing dynamic pages that doesn’t change frequently. I chose mod_disk_cache to use in conjunction with mod_cache as it will provide better performance compared to mod_mem_cache.

The configuration is simple as enabling the module mod_cache and mod_disk_cache and adding the following line to apache configuration.

<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot /var/cache/apache/
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
</IfModule>
</IfModule>

Conclusion

mod_cache, mod_disk_cache is the better way to increase performance of dynamic sites that doesn’t change often.

More details of mod_cache and related caching techniques can be found at

http://httpd.apache.org/docs/2.0/mod/mod_cache.html

http://httpd.apache.org/docs/2.2/caching.html