Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Speed up sync latency between host and guest on Vagrant (NFS sync folders)

I'm using vagrant to run a wordpress dev environment on my local machine, have setup nfs as the default file-sharing mechanism (I'm on a mac). Overall performance is really good except for one thing: sync latency.

I have set up grunt watchers on the guest to recompile css / javascript as well as livereload the page on every file change. However when I save a file on the host: it takes between 1 and 10 second before syncing on the guest.

I'd like to be able to hit save on the host, and see changes being reflected on the guest immediately, which would then trigger the grunt watcher to do all the things I need it to do.

Is there a way to achieve this? Hack to force sync some files with grunt maybe? I've tried rsync and it seemed even worse latency wise.

Thanks

like image 625
Dagobert Renouf Avatar asked Nov 08 '14 15:11

Dagobert Renouf


1 Answers

Found the answer here https://github.com/mitchellh/vagrant/issues/4204#issuecomment-49856008

Just add mount options to the nfs share in Vagrantfile, this will make nfs sharing sync almost instantly on every save (<500ms).

config.vm.synced_folder "www/", "/srv/www/", :type => "nfs", mount_options:['nolock,vers=3,udp,noatime,actimeo=1']
like image 50
Dagobert Renouf Avatar answered Nov 10 '22 05:11

Dagobert Renouf