Is VirtualBox/Vagrant supposed to be this slow or am I missing something?

2.5k views Asked by At

I'm trying to figure out the best way to develop Rails applications in Windows, so, I'm trying running them on a virtual machine with Vagrant. Setting it up was very easy but I find it extremely slow to the point that would make me question why something like Vagrant exists, which makes me think I'm probably missing something.

I'm running Ruby 2.1.5, Rails 3.2, Windows 10, Webrick, latest Vagrant, Ubuntu 14.04 (to match our servers) with 2GB of RAM. Loading a page from the app seem to take almost a minute and a half:

enter image description here

The same page with Rails running inside WSL takes about 10 seconds (also unacceptable):

enter image description here

I'm running on an i5 2.6GHz with virtualization enabled.

2

There are 2 answers

0
George M Reinstate Monica On

You don't supply your Vagrantfile. But yes, file sharing is dead slow on windows if you're not using smb as recommended here by vagrant: https://www.vagrantup.com/docs/synced-folders/smb.html

0
datenimperator On

I'm probably late to the game, but here's what I found out. It's the VirtualBox file sharing which is slow, like in "dead slow". During a request Rails will create temporary files, in particular for Sass and Haml and more. If thousands of files are created, those files will be synced back and forth from the VM to the host. This blocks IO and slows down the request tremendously.

Possible fixes include:

  • Try to exclude paths like tmp from the sync. This is possible using the Vagrant rsync file mechanism.
  • Have faster syncing. This can be achieved using NFS for file sharing. More hassle to setup, but quite faster. Not as fast as it could be, but YMMV.
  • Avoid syncing altogether. I tried to configure Rails to use other paths for tmp et al. but didn't get very far. Maybe somebody else did?