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.
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.
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