drupal icon indicating copy to clipboard operation
drupal copied to clipboard

Edit PHP’s realpath-cache-size, and realpath-cache-ttl for Drupal

Open mstenta opened this issue 5 years ago • 3 comments

Drupal.org's official documentation recommends overriding PHP's default realpath-cache-size and realpath-cache-ttl to "noticeably decrease Drupal's initial page generation times."

https://www.drupal.org/docs/7/managing-site-performance/tuning-phpini-for-drupal

I am currently adding the following lines to my Dockerfile that inherits from drupal:7 to accomplish this:

# Set recommended realpath_cache settings.
# See https://www.drupal.org/docs/7/managing-site-performance/tuning-phpini-for-drupal
RUN { \
    echo 'realpath_cache_size=4096K'; \
    echo 'realpath_cache_ttl=3600'; \
  } > /usr/local/etc/php/conf.d/realpath_cache-recommended.ini

Would it be worth including these in the official Docker Hub images? If so, I would be happy to provide a pull request.

mstenta avatar Oct 15 '18 16:10 mstenta

This does seem reasonably sane to include by default since it's a recommendation directly from Drupal upstream, although I can't seem to find that same content in the Drupal 8 documentation -- any idea where it might have moved to or why it might have been removed?

tianon avatar Oct 25 '18 21:10 tianon

Good question @tianon - My guess is that the Drupal 8 documentation simply hasn't caught up to include everything that is in the Drupal 7 docs. That said, I think this suggestion is just as relevant (if not more) to Drupal 8.

Notably, the Symfony documentation has the same recommendation (Drupal 8 is built on Symfony), with an even higher realpath_cache_size suggestion: https://symfony.com/doc/current/performance.html

mstenta avatar Oct 26 '18 15:10 mstenta

Updated my description above to use Symfony's recommended 4096K value.

mstenta avatar Apr 19 '20 12:04 mstenta