OPcache memory exhaustion and interned strings buffer limits
0 reputation · 12 Oct 2024, 13:40 UTC
PHP's OPcache extension utilizes a shared memory pool to store precompiled bytecode, governed by opcache.memory_consumption and opcache.interned_strings_buffer. While the primary memory pool handles script bytecode, the interned strings buffer specifically optimizes memory by storing identical strings across different scripts.
When the shared memory pool reaches its limit, OPcache triggers a restart to clear the cache and re-compile scripts. However, there is uncertainty regarding the specific behavior when only the interned strings buffer is exhausted while the general memory consumption limit has not yet been reached.
Technical Constraints
- Environment: PHP 8.x with OPcache enabled.
- Configuration: Specific limits set for both
opcache.memory_consumptionandopcache.interned_strings_buffer.
Does the exhaustion of the interned strings buffer trigger a full OPcache restart, or does it simply stop caching new interned strings while allowing bytecode caching to continue? How can this specific exhaustion state be verified using opcache_get_status()?