Once Again, Configuration Matters- or Don't Assume APC is Doing You Favors
A classic unhealthy cache- high miss rate and high fragmentation.
When people talk about performance and Drupal it is rare to not hear APC get mentioned. It is probably the must have performance solution for Drupal. Which makes sense- it's easy to install, effectively reduces the time it takes to load all of the .module, .php, and .inc files, and is usually enable and forget. Basically an easy win.
And yet as I'm about to point out, every article you will ever read about performance should tell you that you need to analyze what you're doing before you assume you've made things better.
The status output of the APC cache that you're seeing here is a great example why configuration matters. The cache size is to small for the codebase which means that not all the files can be stored in the cache. This ends up causing fragmentation leaving even less space. The cache hit to miss ratio is ridiculously high.
A healthy cache.
This second screenshot shows a healthy cache- instead of 32mb it is 256mb in size. Yes, this is probably a bit higher than necessary. You can see the actual amount in use is more like 80mb. The trick here is that in this example there is more than enough room for all the files so no fragmentation occurs and the cache miss rate is quite low. Which is what you want. Hooray.
Cache size is configured in php.ini or apc.ini and you want to set apc.shm_size to an appropriate size.
Categories: Planet Drupal