Skip to content

Slow Drupal on NFS

Drupal includes many files. When DocumentRoot is hosted on NFS, include calls are slow, because too many lstat() calls which are slow on NFS.

Solution is to increase realpath_cache_size in php.ini.


; ...php.ini...
; Determines the size of the realpath cache to be used by PHP. This value should
; be increased on systems where PHP opens many files to reflect the quantity of
; the file operations performed.
realpath_cache_size=1M

; Duration of time, in seconds for which to cache realpath information for a given
; file or directory. For systems with rarely changing files, consider increasing this
; value.
realpath_cache_ttl=300

There is opened bug (tagged as wontfix), which causes realpath cache is disabled when open_basedir or safe_mode are in use.
They must be disabled to realpath_cache to work.

On tested site page load time was 12 seconds, after change is just 2 seconds.

Detailed analyze can be found in original article.

1 thought on “Slow Drupal on NFS”

Leave a Reply

Your email address will not be published. Required fields are marked *