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

牧云@^-^@ 提交于 2019-12-21 01:18:20

问题


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


回答1:


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']


来源:https://stackoverflow.com/questions/26818907/speed-up-sync-latency-between-host-and-guest-on-vagrant-nfs-sync-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!