PHP OPCache, Realpath Cache and Preloading
summary
Explains concrete fixes: realpath cache in process memory so cold FPM children rebuild paths and default size is 4MB; OPcache stores compiled opcodes in shared memory (default block ~46MB) and wastes space instead of defragmenting so doubling memory often ends restart loops and the wasted-memory threshold (default ~5%) triggers restarts; OPcache file_cache for faster CLI/startup and priming new FPM pools avoids compile spikes; preloading is global to the PHP process and boots classes into memory requiring full restart, with real-world gains varying by how many “hot” classes are preloaded.
AI-written summary · about
chapters (21)
- 0:00Intro
- 1:34PHP-FPM
- 3:12Shared memory???
- 5:40Latency Comparison Numbers (-2012)
- 9:12Realpath Cache
- 15:17Throwaway language
- 16:11Vulcan Logic Dumper
- 19:27OPCache Optimizer
- 25:05Interned strings
- 26:30Wasted memory
- 27:53Opcache restarts
- 33:40PHPArch Opcache article
- 34:26Disaster Recovery Scenarios
- 35:25php.net/manual/en/opcache.configuration.php
- 39:49Opcache Priming / Deployment Strategies
- 46:09Preloading in the wild
- 48:23Composer benchmarks
- 50:56Preloading issues
- 53:25Preload resources
- 53:50PHP Performance
- 54:36Elastic Stack @ Combell








