Skip to content

Instantly share code, notes, and snippets.

@hugobarauna
Created April 10, 2012 14:35
Show Gist options
  • Save hugobarauna/2351792 to your computer and use it in GitHub Desktop.
Save hugobarauna/2351792 to your computer and use it in GitHub Desktop.
Why you should use NFS over VirtualBox with Vagrant
If you're using Vagrant, you're probably using VirtualBox shared folders feature in order to access your files from inside the VM. The problem is, virtual box shared folders can get preeeety slow. But, the awesome vagrant guys already dealed with that: http://vagrantup.com/docs/nfs.html. The solution is to use NFS.
Here's my "bechmark" comparing using shared folder, native VM filesystem and NFS.
# Host machine: MacBook Pro, 8GB RAM
# Guest Machine: Ubuntu 10.04 LTS, 750MB RAM
# Putting the Rails app files in the Mac, using VirtuaBox shared folders,
% time ruby script/runner "User.first"
real 0m19.566s
user 0m1.800s
sys 0m6.744s
# Putting the Rails app files in VirtuaBox (Ubuntu) native filesystem
% time ruby script/runner "User.first"
real 0m2.611s
user 0m2.004s
sys 0m0.620s
# Putting the Rails app files in the Mac, using NFS to access the files from Ubuntu
% time ruby script/runner "User.first"
real 0m8.102s
user 0m1.832s
sys 0m1.440s
# Putting the Rails app files in the Mac, using NFS to access the files from Ubuntu (warm cache)
β [vagrant@lucid32:padrao] (ree-autoseg)
% time ruby script/runner "User.first"
real 0m2.799s
user 0m2.076s
sys 0m0.640s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment