DDEV and Mutagen on Apple M1

I’m a Linux desktop user and have been for three years. A driving reason for my switch from Mac to Linux was performance. As a LAMP stack web developer, using Docker-based tools for local development is a must. A nagging problem for developers is the performance of Docker on macOS, specifically file system performance. I share some performance comparisons in the January 2020 blog post, Faster Drupal Development on Linux.

On a recent episode of Talking Drupal, #318 DDEV, Randy Fay, the maintainer of DDEV talked about the DDEV’s recent addition of Mutagen. He claimed DDEV with Mutagen on Mac runs “almost as fast as native Linux.” I had to check it out.

Randy discussing DDEV implementation of Mutagen (5 minutes)

Testing Environment

I configure a newly acquired Mac with an existing Drupal project running locally with DDEV. I also installed this project on my Linux desktop.

  • Mac mini (M1, 2020) – 8GB RAM – 250GB SSD – macOS BigSur 11.5.2
  • Linux desktop – AMD Ryzen 9 3900x – 16GB RAM – 1TB M2 – Pop!_OS 21.04

Testing Process

I followed the steps below with Mutagen turned on and off and ran the test multiple times to verify the results were consistent. I followed the same steps on Linux without Mutagen.

ddev stop --remove-data
ddev poweroff
(set mutagen on or off)
ddev auth ssh
ddev start
ddev mutagen status
rm -rf vendor
time ddev composer install --no-cache 

Results

DDEV without Mutagen on Mac:
composer install --no-cache - 4:41.91 total 
DDEV with Mutagen ddev on Mac:
composer install --no-cache - 16.602 total
DDEV without Mutagen on Linux:
composer install --no-cache - 13.658 total 

Caveats and Conclusion

I only recently started using DDEV after listening to Randy on Talking Drupal, so my experience with it is not much more than conducting this experiment. However, I believe the testing process had enough controls to fairly evaluate a single action; composer install. If I’ve missed something here, I expect someone will let me know.

If you are a PHP developer using a Mac, the results of 4.5 minutes vs. 16.5 seconds demonstrate that DDEV with Mutagen should be evaluated as a local development environment. However, the Mutagen implementation is new and there are some caveats outlined in the Performance Documentation.

While I tested on Apple new M1, I would expect similar results from the Intel line of computers.

I’m glad to have been exposed to DDEV and its helpful community. I will continue exploring a switch to it, even in my Linux environment.

Backstop JS and Lando

I’ve recently started using Backstop JS for visual regression testing. You can add the following settings to your Lando configuration, .lando.yml, to include Backstop JS.

services:
   node:
     type: node:10
     globals:
       backstopjs: "latest"
     command: npm start
     run_as_root:
       - apt-get -y update && apt-get -y install software-properties-common
       - wget https://dl-ssl.google.com/linux/linux_signing_key.pub && apt-key add linux_signing_key.pub
       - add-apt-repository "deb http://dl.google.com/linux/chrome/deb/ stable main"
       - apt-get -y update && apt-get -y install google-chrome-stable
 tooling:
   backstop:
     service: node

You will need to use the .internal URL from Lando to access the local website. For example:

  "scenarios": [
    {
      "label": "Homepage",
      "url": "http://appserver_nginx.your-site-name.internal"
    }

The backstop commands will be run through Lando tooling:

lando backstop reference
lando backstop test