Select Page

Speed up your apache server with mod_cache

Speed up your apache server with mod_cache

Since I am facing performance problem due to the load of visitors and a badly configured server, I decide today to document my findings in this new series of articles.

mod_cache implements an RFC 2616 compliant HTTP content cache that can be used to cache either local or proxied content. mod_cache requires the services of one or more storage management modules.

Server: Strato (
Operating system: SuSE / openSuSE
Requirements: root access and basic Unix knowledge

1Use yast2 to install mod_cache on the system, this will create files (*.so) in   /usr/lib/apache2-worker/ and  /usr/lib/apache2-prefork/
2Edit the file  
# vi /etc/sysconfig/apache2

and add cache and mem_cache
APACHE_MODULES="cache mem_cache deflate headers access actions alias auth auth_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl   userdir php4 php5 perl     rewrite suexec"
3create a new file in /etc/apache2/conf.d/mod_cache.conf

#vi /etc/apache2/conf.d/mod_cache.conf

and add these lines, at the end of file, adapt all path according to your system.

 <IfModule mod_cache.c>
LoadModule disk_cache_module modules/
<IfModule mod_disk_cache.c>
 CacheRoot /tmp/cacheroot
 CacheSize 256
 CacheEnable disk /
 CacheDirLevels 5
 CacheDirLength 3

<IfModule mod_mem_cache.c>
 CacheEnable mem /
 MCacheSize 4096
 MCacheMaxObjectCount 100
 MCacheMinObjectSize 1
 MCacheMaxObjectSize 2048

# apache2-reconfigure-mpm
this recreate the file  /etc/apache2/sysconfig.d/loadmodule.conf
and restart apache automatically.


About The Author

Cédric Walter

I worked with various Insurances companies across Switzerland on online applications handling billion premium volumes. I love to continuously spark my creativity in many different and challenging open-source projects fueled by my great passion for innovation and blockchain technology.In my technical role as a senior software engineer and Blockchain consultant, I help to define and implement innovative solutions in the scope of both blockchain and traditional products, solutions, and services. I can support the full spectrum of software development activities, starting from analyzing ideas and business cases and up to the production deployment of the solutions.I'm the Founder and CEO of Disruptr GmbH.