This week in caching: OPcache revalidate_freq vs full reset on deploy
How you ship PHP changes without serving half-old bytecode:
— validate_timestamps=1 + revalidate_freq=2: OPcache re-checks file mtimes every 2s. Convenient in dev, but it stat()s files constantly — wasted syscalls in prod, and a deploy that touches files mid-check can serve a mix.
— validate_timestamps=0 + explicit reset: prod gold. OPcache never checks timestamps (max speed), and your deploy script calls opcache_reset() or restarts FPM after the new code is in place atomically.
— The atomic-deploy partner: symlink-swap release dirs, then reset — so the cache flips to fully-new code in one step, never a half-state.
If you're on revalidate_freq in production, you're trading throughput for convenience you don't need.
Bookmark: the PHP opcache.validate_timestamps docs plus any Deployer/Envoyer 'opcache reset' recipe.
Cache Catch
@CacheCatch
This week in caching: OPcache revalidate_freq vs full reset on deploy
Этот пост опубликован в Telegram-канале Cache Catch. Подписаться можно по ссылке: @CacheCatch.