Date Published: May 8, 2024
Understanding and Resolving PHP OPcache and OPcache Interned Strings buffer errors
Issue¶
I see errors that may be related to OPcache
Resolution¶
PHP OPcache Caches pre-compiled bytecode. This is quite a bit faster than using PHP to load and parse each script for each and every HTTP request. This cache needs to be large enough to store compiled code for your application's PHP scripts, but not so large that it keeps you from using available RAM for other operations.
Clear sign that this is too small:
php-errors.log Warning: require_once() [function.require-once]: Unable to allocate memory for pool.
If you're finding that there are these errors generated by your application in your php-errors.log, adjust the amount of memory allocated PHP OPcache through the Acquia Cloud User interface .
PHP OPcache Interned Strings Buffer¶
The Interned Strings buffer is the amount of memory (in megabytes M) used to store identical strings (detected by PHP). By default, this is a shared buffer allowing all Drupal PHP processes to reference it across multiple PHP/FPM processes, saving memory. Drupal 8.x makes greater use of the PHP interned Strings buffer than Drupal 7 does, although Interned Strings buffer errors can occur in either version.
Clear sign that this is set too low:
fpm-error.log: Warning Interned string buffer overflow
The amount of memory allocated to the Interned Strings Buffer will reduce the total amount of memory available for PHP OPcache. The default setting is 8MB. If your OPcache is set to 96, this leaves 88MB for normal OPcache usage. If you need to increase the interned strings buffer over 16MB, Acquia recommends increasing the OPcache by the same amount so that you maintain enough available space in OPcache to effectively store precompiled bytecode when long strings are cached.
The OPcache Interned Strings buffer setting can be changed on a per environment basis in the Acquia Cloud User interface, you can adjust that by clicking the gear icon for configure in the environment settings, we have additional information here https://docs.acquia.com/acquia-cloud-platform/manage-apps/php#opcode
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.