Vagrant is an awesome tool. If you’re not using it on your development project then you should get your head checked. Being able to magically recreate a whole development environment with a simple vagrant up command is a godsend even if you’re the only developer working on a project. It saves time (aka money) and countless headaches. Now, this isn’t a post about Vagrant but I wanted to set the stage. This post is about a couple of the popular providers that you can use with Vagrant — Virtualbox and VMware.
Virtualbox’s best feature is it’s price. It’s free! Don’t get me wrong, it does work and for some people it works well enough. The two glaring issues I have run into with Virtualbox are the shared folders and the overall performance. Some people that I’ve talked to have claimed that the performance hit is related to shared folders and going a different route (SMB, NFS, etc) resolves this. More critically, we have also run into a bug with how it handles symlinks. Somewhat surprisingly, we have only encountered this on Windows host machines; Mac’s seem unaffected. More on the performance issue below…
VMware has so far proven to be a great choice. It’s stable, fast, and everything simply works. The downside is that Hashicorp wants $80 for the VMware plugin. That’s on top of the price of VMware Workstation or Fusion. Note that VMware Player will not work. Not exactly cheap.
There are countless ways to measure this. The way I did it may not be the best way nor representative of your usage. Take this with a grain of salt. I work with a fairly large PHP application. To measure, I took five different pages from the app and profiled each page three times with xhprof. Then I graphed the average of the three runs for each page. For those that are curious, the app is built on ZF1. Here are the results for both Virtualbox and VMware…
If you’d like to see the raw numbers, comment below and I’ll post them later. All reasonable efforts were made to eliminate as many variables as possible. Although the VMware base box couldn’t be the same one as the Virtualbox one, they both were running Centos 6.2 with the same versions of Apache, MySQL, etc etc. As you can very easily see, the app ran much faster with VMware. This confirms the perceived ‘snappiness’ disparity between the two.
For any real work, you’ll want to at least strongly consider VMware. There is a cost but even if you save a few hours of pain later on, it’s worth it. If you do go the Virtualbox route, you’ll be happy to know that it doesn’t take too much work to make the switch later on if you have decent Vagrant and Puppet (or Chef) scripts setup already.
As a workaround, NFS is looking like it’s a potentially viable alternative to the shared folders offered by VMware and Virtualbox. I’ll report those results after tinkering with NFS and profiling again.