Faster Drupal Development on Linux

Stephen Cross
3 min readJan 23, 2020

Local Drupal development has moved to docker-based environments with solutions like Lando and DDEv. With these tools, it’s fast and easy to spin up a local environment and manage many projects. The days of MAMP and WAMP are (long) gone.

Here’s the problem, Mac OS is the dominant development platform for Drupal developers, and Docker runs terribly on it. Docker interacts differently with macOS than it does with Linux. The multiple layers of communication between Docker and the macOS file system make file-sharing very slow. In contrast, Docker’s direct access to the Linux file system makes it very fast. This video, Improving Docker Desktop File Sharing Performance, from DockerCon 18 describes this issue in detail.

The file-sharing performance issue became apparent when working with a colleague to set up a new Drupal 8 website build. I was shocked to see the local build process taking over 8 minutes on my colleague’s computer and less than 30 seconds on mine.

Benchmarks

In an unscientific way, with some help from my friends, I tested the build process on a few Macs and Linux computers with different hardware specs. Each computer had Docker and Lando installed. The website is a Drupal 8 Standard profile with Acquia’s BLT. The test is simple, run the BLT artifact build, blt artifact:build

Below are the shocking results of this test, with Linux being 6,000% faster.

Solutions

There are some potential solutions. Lando has an undocumented Mac-only feature called “Turbo Mode”. Reviewing the issue thread, there are mixed results with this implementation. Turbo Mode had little impact on my test case shaving off 30 to 60 seconds. A 5% to 10% improvement is good, but there is no practical improvement when comparing it to performance on Linux. Others have seen better improvements with Turbo Mode. This approach is easy to implement and worth exploring, but Turbo Mode hasn’t made its way into Lando as a supported feature. Use with caution.

Some tweaks can be made to your Docker configuration. Increasing the default RAM usage from 2GB to 4GB is a starting point. You can also limit the number of shared folders Docker watches; by default, the entire /Users folder is included. I tested the memory upgrade and limited the shared folders to only the necessary application folders. Similar to the results with Turbo Mode, they were minimal for my test case. You may have more promising results. There are many online resources with recommendations to improve performance; search “Docker Mac performance”.

I suspect more research and testing could result in better performance on Mac. But, using Linux for Drupal development with Docker will get you the best performance by far, with ease. It’s that simple.

Originally published at http://stephencross.com on January 23, 2020.

--

--

Stephen Cross

A web developer for 25+ year. Drupal developer, podcaster and Linux enthusiast.