Realpath cache configuration best practices

Realpath cache caches the real file system paths of filenames referenced instead of looking them up each time. Every time various file functions are performed or require a file and use a relative path, PHP has to look up where that file really exists.

To improve Commerce performance, use the following recommended settings to configure the realpath_cache settings in the php.ini file:

  • Set the cache size to 10 MB (realpath cache_size=10M)
  • Set time to live (ttl) to 7200 seconds (realpath_cache_ttl=7200)

For configuration instructions, see How to set PHP options.

Affected products and versions

  • Adobe Commerce on-premises, all versions 2.3.x and above
  • Adobe Commerce on cloud infrastructure, all versions 2.3.x and above

Potential performance impact

If the Realpath cache configuration values are too low or too high, it adds additional overhead during cache generation which slows performance.

Additional information

recommendation-more-help
754cbbf3-3a3c-4af3-b6ce-9d34390f3a60