Zend OPcache revalidate_freq staleness across PHP-FPM workers
0 reputation · 26 Aug 2024, 10:23 UTC
Zend OPcache revalidate_freq staleness across PHP-FPM workers
Goal: Determine whether a PHP script changed during the opcache.revalidate_freq window can still be served as stale bytecode to some requests in a PHP-FPM pool.
OPcache checks script modification time at most once per revalidate_freq interval when opcache.validate_timestamps is enabled, and shared OPcache memory is common to all workers in the same pool. There is no built-in atomic invalidate-all that forces every worker to drop an old entry simultaneously.
Version assumptions: PHP 8.x with OPcache enabled, PHP-FPM SAPI, opcache.validate_timestamps=1, opcache.revalidate_freq=2.
- Does a file changed within the revalidate_freq interval become visible on the next request to every worker, or only after each worker's next timestamp check?
- Can opcache_invalidate() on one file guarantee all workers in the pool stop serving the stale entry at the same time?
- Is per-pool OPcache isolation required to prevent one application's stale bytecode from affecting another virtual host in the same pool?