Monitoring apache’s caching

apache-2.2mod-cachemonitoring

I'm running mod_mem_cache with mod_cache, but I don't seem to have any way of telling whether images are served from the cache or not, so I can't tell how well it's working. Is there some way of seeing via mod_status, adding cache status headers to responses or similar?
The servers it's on are quite happily handling sustained loads of about 200 requests/sec, but I can't tell if/how much the caching is helping that.

Best Answer

You have a few options from the access log perspective.

1) log %{Age}o and everytime it's non-empty, it was served from the cache (this doesn't work if you're proxying to something that also is setting the Age header!)

2) SetEnv CACHE_MISS 1 and log %{CACHE_MISS}e

This second one works because the SetEnv directive only has a chance to run when the response is NOT served from the cache, and the environment variables are not stored in the cache.

Related Topic