Use NFS to speed up your Homestead VM
Made the switch to Laravel Homestead and Vagrant in your dev workflow? Wondering why it's not responding as quick as your production environment?
Yeah...been there.
A bit of googling led me to the solution that using NFS for your synced folder is the way to go. Simply replace the folder sync settings in your homestead.rb with the following:
# Register All Of The Configured Shared Folders
settings["folders"].each do |folder|
config.vm.synced_folder folder["map"], folder["to"],
id: folder["map"],
:nfs => true,
:mount_options => ['nolock,vers=3,udp,noatime']
end
Props go to Stricken for the solution: https://laracasts.com/forum/?p=1757-slow-responses-on-homestead/p1#p7694
Avoid caching issues
You'll also need to make sure you turn off sendfile in your apache/nginx config to avoid caching strangeness. Props to adamwathan for this: https://laracasts.com/forum/?p=1757-slow-responses-on-homestead/p1#p7700
For more detailed info on the sendfile change checkout Pierre Groth's tip here: https://coderwall.com/p/ztskha
Written by Steve Oldham
Related protips
5 Responses
On the latest version of Homestead, you can simply edit your Homestead.yaml
file and change the folder type. E.g. folders:- map: ~/Code to: /home/vagrant/Code type: nfs
and make sure that "winnfsd.exe is running in your processes."
Not really TomSta, this post is about Mac.
How to check if "NFS" is actually working apart from drastically improved performance? :) I'm concern about mine, looks like it is not set properly (Mac OS X Yosemite, Homestead 2 latest version).
Doesn't look like @zejesago tip working for me.
Thanks!
I'm finally able to install decent, fast and working configuration with such versions of corresponding tools:
I'm using Mac OS X 10.10
Vagrant 1.7.4 https://bintray.com/mitchellh/vagrant/vagrant/1.7.4/view#files
VirtualBox 5.0.11 r104456 https://www.virtualbox.org/download/testcase/VirtualBox-5.0.11-104456-OSX.dmg