2

Many people use NFS to keep the sites/default/files directory outside of the normal webroot of a Drupal install.

However, I'm running the entire Drupal install over NFS.

When the site has not been accessed in some time, there's a solid 15-20 seconds of delay before a page loads. After that everything is fine. I have Drupal's page caching turned off for these tests to provide consistent results.

Initially I found that PHP's realpath_cache needed to be adjusted, because the default of 16k is not enough to handle all of paths Drupal loads when bootstrapping. I have this raised to 128k, and I see now that the utilized cache size goes up to around 40-50kb (after browsing around the site all over to "trigger" more file loads).

However, that does not seem to affect performance at all. Those cache entries expire anyway and will eventually PHP will need to hit the FS again.

I also have the built in "poor mans cron" disabled, so it's not related to Drupal running a bunch of cron tasks on that page load.

I suspect it may be related to NFS.

Is anyone else running a Drupal install completely over NFS, or have you in the past and come to any conclusions that may help?

6
  • Do you have APC or an equivalent Opcode cache installed?
    – mikeytown2
    Dec 18, 2013 at 18:58
  • Not yet - but I do realize that will probably circumvent most issues since the FS wouldn't be touched most of the time
    – Brian
    Dec 18, 2013 at 20:02
  • 1
    The filesystem still gets checked on every pageload unless you set stat=0. So adding in an Opcode cache will help but reducing stats on NFS files will help even more.
    – mikeytown2
    Dec 18, 2013 at 21:33
  • Do you use static nfs mounts or automount? If you use automount, the mount needs to get re-established if not acessed for a while, thus delaying the first page load.
    – Ursula
    Dec 19, 2013 at 6:36
  • 1
    Static mount did not change anything
    – Brian
    Dec 30, 2013 at 14:28

1 Answer 1

2

Assuming APC is installed; inside php.ini

; http://www.php.net/manual/en/ini.core.php#ini.sect.performance
realpath_cache_size=1M ; 1MB
realpath_cache_ttl=3600 ; 1 hour

; APC
; http://www.php.net/manual/en/apc.configuration.php
apc.ttl=2419200 ; 4 weeks
apc.localcache = 1
apc.localcache.size = 1024
apc.num_files_hint = 2048
apc.user_entries_hint = 128

apc.file_update_protection = 10
apc.stat = 0
apc.stat_ctime = 0
apc.file_md5 = 1

; OPcache
; http://www.php.net/manual/en/opcache.configuration.php
opcache.enable_file_override = 1
opcache.validate_timestamps = 0

Then when your code changes you need to restart Apache or run

apc_clear_cache('opcode');
opcache_reset();

And for Drupal install the following modules as these are designed to help with the drupal files dir when used on a NFS filesystem
https://drupal.org/project/imageinfo_cache
https://drupal.org/project/advagg
https://drupal.org/project/httprl (will speed up the above 2 modules)

3
  • The 1MB seems excessive for the realpath cache size. I found that a Drupal site with a decent amount of modules enabled uses less than 100KB. Also, you recommend turning off stat so that APC doesn't need to be hit at all? I think we'd plan on using php.net/opcache instead of APC as well.
    – Brian
    Dec 18, 2013 at 20:04
  • It really depends on your site and how many files are inside the shared files dir. 1M is needed on our massive 1000+ domain install. At worst you'll be wasting a small amount of ram.
    – mikeytown2
    Dec 18, 2013 at 21:40
  • I think I'd rather attempt to solve the real issue rather than trying to hide it by keeping all file data in RAM - though I do realize the benefit if using an opcode cache
    – Brian
    Dec 30, 2013 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.