Categories
Software

Slow Vagrant?

Maybe you’re a file hoarder, like me.

I switched to using VVV a few years ago, when it became cool to use Vagrant and when unit testing became a must-have part of my daily WordPress development process.

Truth be told, I’ve missed the simplicity of MAMP PRO ever since, even if I do prefer Nginx over Apache these days.

And if you’re like me, you never really delete stuff, it just goes someplace else. Git enables this; I pack away repositories like a squirrel, thinking that I’ll clone something now and peek at it later.

I have a 6 core Xeon powered Mac Pro at my office. It’s usually sitting idle as a task runner for all sorts of client work that requires a bit of additional TLC. I push some code from my MacBook to Gitlab; Gitlab tells my Mac Pro to make sure everything is still green; I move on to the next task.

So lately, my Mac Pro has seen abysmal performance when it comes to Vagrant related tasks. Things like up, ssh, and box update would take several minutes to complete. Last night, it took 6 hours to vagrant up --provision so I finally gave up and decided to figure out what the heck was going on.

Screen Shot 2016-05-05 at 12.58.27 PM.png
73 seconds to vagrant ssh.

I guess it was my own fault. I keep a local mirror of plugins.svn.wordpress.org on my Mac Pro, which pulls down about 70k WordPress plugins, creating over 339,000 directories.

Screen Shot 2016-05-05 at 1.02.06 PM.png
This kills the VVV.

What I discovered is that the number of directories in your VVV’s www directory can have a severely negative impact on the performance of your vagrant commands, even if those directories are largely dormant and do not contain a relative vvv-hosts or vvv-init.sh files to treat them as actual sites.

I have a few hunches about what’s causing the slow down, but haven’t the time to dig much deeper:

  • Guest Additions might front-load the directory tree, in such a way that locks the rest of Vagrant from proceeding, maybe part of the vagrant-vaguest plugin?
  • Some other plugin feels the need to traverse the directory tree without a max-depth flag
  • VVV or Vagrant have internally optimized for traditional web directories that do not have hundreds of thousands of directories

Hope this helps, and if you figure out the rest of this, drop me a comment! <3

By JJJ

I help build WordPress, BuddyPress, bbPress, Easy Digital Downloads, Sugar Calendar, and a bunch of other super-neat stuff.

6 replies on “Slow Vagrant?”

The performance of Virtualbox shares is pretty terrible. Vagrant will let you switch to NFS or, ideally, rsync. With Rsync, you need to manually run `vagrant rsync` or make sure `vagrant rsync-auto` is running.

Hey John,

Steve from Piklist just pointed me to this post. Wondering if I could get you to take a look at an alternate to VVV where our goal is to focus on Developer Experience aka DX:

http://github.com/wplib/wplib-box

We are in beta currently so we are trying to iron out any issues people have with DX, but those far we are getting some great feedback, check it out:

https://twitter.com/wplib/with_replies

Would love to get your feedback if you do have time to check it out, here or on Slack – you know how to find me. 🙂

-Mike

I did yesterday, and at a cursory, I think I agree. There are some bugs, and some kinks to iron out, but the biggest potential with Valet is the bridging of 2 hugely awesome communities.

Comments are closed.