Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The Problem

I'm attempting to diagnose a performance issue on a Drupal website I'm developing. In the morning, when the site has seen no traffic (not even a cron run) for over 8 hours, the homepage takes around 3.5 seconds to load. Reloading the page takes an expected 250ms.

This is a development web server, with a fairly old version of PHP installed (5.3.3). All of the files are statically mounted over NFS (which I believe is the root cause, more on that below).

To help diagnose, I installed XHProf on this development server, and enabled a Drupal module that profiles page loads and displays the profiling data in a nicely sortable table. For those unfamiliar with XHProf, it provides data on every function called and things like the total time spent, memory usage, and calls for that function.

My Findings

On the initial "slow" hit, the PHP function file_exists took 1400ms from 82 calls, accounting for roughly 43% of the total execution time. On the subsequent page load, the same function file_exists was again called 82 times, but this time it was dramatically reduced to just 3ms accounting for just 1% of the total execution time.

I additionally looked at the file that took the longest for PHP to load into memory (which is what I believe the load:: prefix means on a function name). This PHP template file took a whopping 42ms to load the first time around, and only 3ms on the subsequent reload!

What I suspect

It's clear to me there is some sort of caching going on somewhere - I just don't know where yet. The PHP docs for file_exists mention that the output of this function is cached. I then found I can control the size of this cache and it should probably be increased from the default 16k to something more appropriate for Drupal (which loads tons of relative files).

However, while I think that would reduce the amount of time spent in file_exists, I'm not sure that will affect the time PHP takes actually loading the file (the load:: I mentioned earlier) and increasing this value seems to just be hiding underlying performance issues with the file system.


  1. If there are any XHProf or PHP veterans that can confirm if the increasing PHP's realpath_cache had any impact on the time reported in load:: from XHProf?
  2. What underlying caching mechanisms should I be aware of in Linux that could have an impact?
  3. Same as above, but for NFS?
share|improve this question
Which version of NFS? TCP, UDP? – Steve-o Jan 13 '14 at 20:10
Drupal has a cron built in for cache refresh that causes this (from my experience working with a few Drupal builds), this article has good… – Schrute Jan 14 '14 at 5:44
@Schrute, this is unrelated to Cron, I have Drupal 7's built in "poor mans cron" disabled – Brian Jan 14 '14 at 12:59
@Steve-o, I'm honestly not sure? – Brian Jan 14 '14 at 12:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.