I’ve noticed a few posts about Discourse running very slow in VirtualBox on Windows. I had the exact same issue and started Googling around. The main problem seems to be related to the shared folder, or at least that was the case for me. Now I’d like to share my potential solution to it.
The first potential fix is basically creating a local folder on the VB machine and using rsync to synchronize all changes. This solution worked pretty well, and the load time was significantly better.
But I don’t like having to type rsync every time the code changes. What can I do?
So I started investigating why the shared folder is so slow. After looking around I was pretty confident that it had to do with the file system difference on the Windows and the Ubuntu machine. The key is to enable NFS to the shared folder.
I partly followed the comment from phazei here:
Here’s what I did:
- Install the vagrant-winnfsd plugin:
vagrant plugin install vagrant-winnfsd
- Modify the Vagrantfile by replacing the following lines:
config.vm.network :private_network, ip: "192.168.10.200"
config.vm.network :private_network, ip: "192.168.10.200", type: "dhcp"
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => nfs_setting
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", :nfs => true, :mount_options => ['nolock,vers=3,udp,noatime']
Of course this is just an experiment and I would love to get feedback on this. But this worked like a charm for me, the page load is as fast as the rsync solution and I don’t have to synchronize files anymore.
What do you think, can this be simplified or done differently?