Several NFS folders for one Drupal instance I'm using vagrant &amp; virtualbox to create drupal websites on my Windows local machine.
My actual drupal website is under a Windows folder, shared with my guest(ubuntu) by using a Windows NFS server (winnfsd).

After playing with NFS mount caching options, I understood that my website becomes really fast when enabling it.(specially files attributes caching with high actimeo parameter)

The website becomes fast, but it's almost unusable to developp at the same time:


Changes in my Windows text editor (Sublime Text) are not seen by Linux.
Sass/compass/gulp also don't see changes made in Windows if actimeo is superior to few seconds.


And when there is no NFS cache at all, I could see that lots of NFS operations are logged by my NFS server logs. Every Drupal files are accessed even several times to get attributes, nslookup, read, access...

So my idea was to make several NFS mounts, with different NFS caching options.


Drupal core files never changed => really long NFS cache
Contrib modules changed rarely => really long NFS cache
Custom modules change often => NO CACHE
My Themes change often => NO CACHE


So here is my question, is it good assumptions ? 
If yes how do we make those kind of multiple NFS shares ? 
I thought about Symlinks ?
Any one tried this approach ?
ini_set('opcache.validate_timestamps', FALSE);


Then when you want to push a code change out run

opcache_reset();


or restart the Apache process.

If you're working on a set of files you can use opcache_invalidate() to check if those files need to be recompiled.

// http://stackoverflow.com/questions/24783862/php-recursively-list-all-files-in-directory
function get_dir_contents($dir, &amp;$results = array()){
  $files = scandir($dir);

  foreach($files as $key =&gt; $value){
    $path = realpath($dir. DIRECTORY_SEPARATOR. $value);
    if (!is_dir($path)) {
      $results[] = $path;
    }
    elseif (is_dir($path) &amp;&amp; $value != "." &amp;&amp; $value != "..") {
      get_dir_contents($path, $results);
      $results[] = $path;
    }
  }

  return $results;
}

// https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!OpCodeCache.php/function/OpCodeCache%3A%3Ainvalidate/8
function invalidate_opcodecache($pathname) {
  clearstatcache(TRUE, $pathname);

  // Check if the Zend OPcache is enabled and if so invalidate the file.
  if (function_exists('opcache_invalidate')) {
    opcache_invalidate($pathname, TRUE);
  }
  // If apcu extension is enabled in PHP 5.5 or greater it emulates apc.
  // This is to provide an easy upgrade path if you are using apc's user
  // caching however the emulation does not extend to opcode caching.
  // Therefore we need to check if the function exists as well.
  if (extension_loaded('apc') &amp;&amp; function_exists('apc_delete_file')) {
    // apc_delete_file() throws a PHP warning in case the specified file was
    // not compiled yet.
    // @see http://php.net/manual/en/function.apc-delete-file.php
    @apc_delete_file($pathname);
  }
}


$file_path = 'sites/all/modules/custom';
$files = get_dir_contents($file_path);
foreach ($files as $pathname) {
  invalidate_opcodecache($pathname);
}
$file_path = 'sites/all/themes/custom';
$files = get_dir_contents($file_path);
foreach ($files as $pathname) {
  invalidate_opcodecache($pathname);
}


Put this code in your settings.php file. 

If using APC the info for that is located here: Best APC settings to reduce page execution time

And apache: Adding .htaccess within httpd.conf correctly

Also see: First page load/execution slow, login slower Drupal 7