Improving Local Performance with Docksal and Virtualbox

If you’ve developed with Docker on Mac OS, you likely know the struggle of slow local performance. Here at Savas, we frequently work on Drupal projects with large databases, and at times slow local performance becomes a frustrating and inefficient use of time. As a team, we’ve worked hard to troubleshoot and have made gradual gains in this area.
We primarily use Docksal on our projects, a shift we’ve made fairly recently. Initially, we got set up using Docker Desktop mode on Docksal. In our journey of speeding up performance, I spent an afternoon reading through Docksal’s documentation on Docker modes and decided it was worth trying to switch back to the default of Virtualbox.
Personally, my favorite form of experimentation is just diving right in, and as it turns out, switching modes on Docksal is quite easy! Their aforementioned documentation lays it out nicely, but I’ll walk you through it.
First off, quit Docker Desktop and install VirtualBox. I used Homebrew, though downloading it directly is an option as well.
brew cask install virtualbox
After installing Virtualbox, you'll need to update your Docksal configuration.
fin system stop
fin config set --global DOCKER_NATIVE=0
fin system start
Everyone's setup is different of course. If you run into trouble, Docksal's troubleshooting documentation should get you on track. I had to run fin vm regenerate-certs
, but that of course won't be true for everyone.
While going through this process, I ran benchmarks on regular commands I usually run during my day to day development, laid out in the table below. While fin system start
takes a little extra time, it’s a command that gets run once when I’m booting the project up.
Command | Time Difference |
---|---|
fin system start |
25s slower |
fin init * |
5min faster |
fin drush cr |
21s faster |
fin drush cim |
13s faster |
*fin init
covers a lot of different processes and generally will always take at least a few minutes to run.
The most notable difference for me is large gains in simply navigating and saving changes through the UI, refreshing pages (without a cache clear), and generally browsing the site. It’s a bit harder to quantify the gains here. I like to simply think of it as a large decrease in the general frustration I feel during the day :)
A Note on CPU Usage
I monitored my CPU usage through Activity Monitor very informally - just keeping an eye as things ran. Both surged above 100% at times, but in general, VirtualBox used 20-30% less CPU.