0

I have installed APC, but I am not observing as big an impact on performance as I expected. Actually, I'm not sure I'm observing any benefit, though maybe it's just because the cpu time spent in interpreting php code is negligible compared to the execution of my own code.

So I'm wondering: is it perhaps because I'm running PHP as an apache module (as opposed to fastcgi) and/or because php is using prefork (as opposed to worker)? Does any of these somehow defeat the performance improvement that could be achieved by means of APC?

1

APC works correctly with mod_php in the sense that all Apache processes share the same APC cache. In fact, a FastCGI configuration may be more problematic in this respect (e.g., if using mod_fcgid, APC shared cache will not work properly; however, php-fpm should not have such problems).

APC may need some tuning to work well; e.g., the default shared memory size (apc.shm_size=32M) is probably too small. You can use the apc.php script distributed with APC to get some performance metrics for your cache — put the script into a web-accessible directory serviced by the same cache instance (with mod_php this means “any virtual host on the same Apache instance”) and access it from a web browser while some load is present on your actual site. Your cache should not become full on a normal site load (it's OK if the cache becomes full on some rare admin requests, but the PHP code used to reply to requests from normal site users should always fit in the cache to get maximum performance).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.