mod_memcached_cache ------------------- This module allows an Apache 2.2.x instance to use one or more memcached instances for HTTP 1.1 document caching, in addition to/instead of the modules distributed with Apache for file and in-process memory caching. Installation ------------------- See INSTALL for details. Implementation ------------------- My guess is that mod_memcached_cache will be useful in conjunction with one or both of the bundled caching modules: On the plus side, it allows more than one Apache server to serve the same cached data, so that, for example, a group of servers behind a reverse proxy can have a high cache hit rate for requests because once one server caches a document, its cached for them all. Similarly, that proxy server itself could potentially skip requests to those backend servers more often because they, too, are working to keep requests cached. The downside is that each cache hit still requires two memcached requests, which won't be as fast as in process memory (with mod_mem_cache). I haven't benchmarked the difference between a mod_memcached_cache hit and a mod_disk_cache hit. Configuration ------------------- # in your httpd.conf # load 'em up. LoadModule cache_module modules/mod_cache.so LoadModule memcached_cache_module modules/mod_memcached_cache.so <IfModule mod_memcached_cache.c> # enable caching of anything below / CacheEnable memcached / # configure memcached servers to connect to. you can specify one or more per # line, andthese can be repeated if you # hate wrapping lines. MemcachedCacheServer localhost:11211 localhost:11212 MemcachedCacheServer localhost:11211 # limit the number of servers that can be configured. if left out, # mod_memcached_cache will just add all of your servers to the list. i'm # not sure this is useful, really, but its an option. MemcachedMaxServers 10 # these four options control the number of persistent connections that will # be made to each of your configured memcached servers PER httpd child. # i haven't done a lot of testing here, so you may want to play around with # these a lot. if you are using the worker mpm, my guess is that having an # available connection for some larger percentage of the possible number # of request handling threads would be advantageous. # again, these numbers are per httpd child process ... # min MemcachedMinConnections 10 # soft max MemcachedSMaxConnections 10 # hard max MemcachedMaxConnections 10 # how long the number of extra connections will remain, in seconds MemcachedConnectionTTL 10 # these two allow you to limit (up and down) the size requirements for the # content of the item being cached, in bytes. note that memcached has a # 1MB default maximum object size, so setting MemcachedCacheMaxFileSize # higher than that without recompiling memcached to handle that size will, uh # be bad. MemcachedCacheMinFileSize 1 MemcachedCacheMaxFileSize 1048576 </IfModule>