Checking OPcache, RealPath Cache, PCRE Cache and OPcache Interned Strings Buffer with Blackfire
Make sure your caches are properly configured every time you profile your app. Better, in conjunction with the Quality add-on, let Blackfire tell you whenever your configuration is incorrect.
Correctly configuring PHP caches is critical for optimal performance: you should not get to a full cache. Enterprise users were already able to benefit from Blackfire’s ability to track the usage of OPcache, RealPath Cache, PCRE Cache and OPcache Interned Strings Buffer.
This feature is now available for any paid subscription: Profiler, Premium and Enterprise!
Anytime you profile your code, when viewing the profile data, simply click on the profile name to view the cache information:
realpath() function returns the absolute path for any given relative file path. This conversion takes a non-negligible time because it performs some filesystem calls. That’s why PHP caches the results of
realpath() calls and their associated
stat() calls. The
realpath_cache_size ini setting defines the size of this cache.
The realpath cache is only used for file paths that exist and is used for most of PHP filesystem calls. Complex applications involve a lot of file operations, so this cache size must be increased accordingly.
Interned strings are a nice memory optimization that was added in PHP 5.4.
PHP stores immutable strings (a
char *) into a special buffer to be able to reuse its pointer for all occurrences of the same string. This
setting can be adjusted using the
Get the most out of it with the Quality add-on
The Quality add-on, which we recently released, is all about recommending appropriate
php.ini configuration. It will directly warn you whenever your configuration for those caches is incorrect, saving you even more time to optimize performance.