APC -> APCu / OPCache, performance poor APC -> APCu / OPCache, performance poor php php

APC -> APCu / OPCache, performance poor


Right now you are checking every file on every request for changes, which probably isn't what you want on a production system.

I usually just disable it (remember to restart the web server after making changes):

opcache.validate_timestamps=0

Alternatively, you can try setting the frequency to something other than 0 and keep it enabled:

opcache.validate_timestamps=1  opcache.revalidate_freq=300

This should theoretically only check for changes every 5 minutes.


You also have

opcache.consistency_checks=1

Which according to the docs says will slow down performance. Turn that off.

opcache.consistency_checks integer

If non-zero, OPcache will verify the cache checksum every N requests, where N is the value of this configuration directive. This should only be enabled when debugging, as it will impair performance.


From the RFC that was responsible for making OPCache integrated into PHP:

APC can reclaim memory of old invalidated scripts. APC uses a memory manager and can reclaim memory associated with a script that is no longer in use; Optimizer+ works differently, and marks such memory as ‘dirty’, but never actually reclaims it. Once the dirty percentage climbs above a configurable threshold - Optimizer+ restarts itself. Note that this behavior has both stability advantages and disadvantages.

My guess is that you are hitting the threshold that triggers the opcode cache restart.

Reference: https://wiki.php.net/rfc/optimizerplus#advantages_of_apc_over_optimizer