(Anonymous, 2007-03-29 15:22)
(Anonymous, 2007-04-24 13:30)
Mod_mem_cache is a plugin which stores content of files in memory for faster serving. It's more configurable than OS buffers (at least, linux buffers), in some cases yields better performance.
For example, you can configure it to cache files smaller than 5 kb, just cache files with a specific mime type or different strategies to free memory when the configured limit has been reached.
This module is a 3rd party module, is not included in the official distribution. You need to download it from here:
* For lighttpd 1.4.13: [http://www.linux.com.cn/tag/mod_mem_cache mod_mem_cache]
* For lighttpd 1.4.15: [http://bergstroem.nu/lighttpd-1.4.15.mod_mem_cache.v1.2.patch] (unsupported, straight port from 1.4.13 patch)
There's not much documentation. See [http://www.linux.com.cn/archives/171.html]
* mem-cache.enable: mem-cache.enable. enable or disable mem_cache, default to enable
* mem-cache.max-memory: mem-cache.max-memory. maxium memory in Mbytes used by mod_memcache, default is 512 (512 ''Megabytes''). 512(means 512M memory).
* mem-cache.max-file-size: mem-cache.max-file-size. maxium size in kbytes for single cache file, default is 512 (means 512 ''Kilobytes''). 512(means 512k bytes).
* mem-cache.lru-remove-count: mem-cache.lru-remove-count. number of cached items to remove when used memory reached maxmemory by LRU algorthim. default is 200.
* mem-cache.expire-time: mem-cache.expire-time. cache's expire time in minutes. default is zero which means to check etag every time
* mem-cache.filetypes: mem-cache.filetypes. content-type arrays which want to put into cache content. default is not set which means to cache all types. for examples: mem-cache.filetypes=("text/css") to cache css files only.
* mem-cache.slru-thresold: Adjusts slru threshold (against hit counter). Default is 0 (disabled)
=== Additional info concerning SLRU balancing ===
The SLRU has one mem-cache.slru-thresold. "one LRU cache for the probationary segment, one for the protected segment. On the first miss miss, an entry is added to the probationary LRU cache without any cache, with no data. Only if its hit count increases over threshold it is propagated to the protected LRU cache which has real content. That way you decrease the propability that an entry is kicked out of the LRU cache as you increase the threshold for one entry getting into the cache. cache." In practice, mem-cache.slru-thresold should adjust to archieve higher hit-rate and less memory usage usage.