Skip to main content

OPcache Tuning for Production

OPcache stores compiled bytecode in shared memory. opcache.memory_consumption (256MB on busy sites) and opcache.max_accelerated_files (20,000 for big apps) are the first knobs to t…

April 10, 2026 PHP chris 1 min read Caching

Article takeaway

OPcache stores compiled bytecode in shared memory. opcache.memory_consumption (256MB on busy sites) and opcache.max_accelerated_files (20,000 for big apps) are the first knobs to t…

OPcache stores compiled bytecode in shared memory. opcache.memory_consumption (256MB on busy sites) and opcache.max_accelerated_files (20,000 for big apps) are the first knobs to tune.

In production set opcache.validate_timestamps=0 and clear the cache during deploys. Otherwise the timestamp check costs syscalls on every request.

For containerised deploys, preloading with opcache.preload can shave a few more milliseconds — particularly useful for Laravel and Symfony framework files.

Share X / Twitter LinkedIn

Leave a comment

Related Posts