Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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