grahl/ch

Comparing Lando performance on M1 Pro

This post was updated 2021-11-27 with additional numbers from the experimental feature “Use the new Virtualization framework.”

In the previous post we saw how the file system mounts can have a huge impact on overall Docker performance. Since then Apple has introduced their new Macbook Pro on their M1 architecture and significant work has happened so that there are now images available for Lando.

Apples and oranges

When running Docker Desktop images they can actually be built for an Intel architecture but performance issues are likely to arise there. For the time being this includes the default Lando database backend from bitnami/mysql.

You can see this in Docker Desktop with the “amd64” warning label or follow this post from Stack Overflow to find the image architecture.

Unfortunately the official mariadb is not a drop-in replacement for bitnami/mariadb so it can’t be used a service override, or if you do know what it would need consider adding it to The Great Armification #2688.

Speed comparison

As previously we use PHPUnit to run a test suite, this time a bit smaller with 19 tests and 227 assertions on PHPUnit 9.5 with PHP 7.4. Numbers are averaged across 2-3 tests. (Since some suggest PHP 8 might make a difference: Numbers seemed identical on M1.)

A notable difference from the last comparison is that we are using SQLite in memory as our test backend for the database to avoid any measurement error since the I/O bottleneck is the largest contributor to any performance issues for Docker on macOS.

System Test execution
i5 4 core Linux Docker 47s
i9 8 core macOS native 24s
i9 8 core Docker* 32s
i9 8 core Docker 1m54s
M1 Pro 10 core macOS native 28s
M1 Pro 10 core Docker* 59s
M1 Pro 10 core Docker 3m54s
M1 Pro 10 core Docker experimental* 36s
M1 Pro 10 core Docker experimental 1m46s

*) with Drupal core/contrib/vendor in exclude †) without exclude

Of course this one testsuite is highly subjective, not generally applicable and only looks at burst performance but that’s also something quite common for developers to need. Iterate, rerun, and not wanting to wait.

It’s noteworthy that on M1 nearly all tests ran slower, even native, so there is likely some optimization in the runtime still possible in future versions of PHP on ARM, since from the commonly published single-core scores the M1 Pro should be significantly faster.

Conclusion

Lots of improvements have gone into Docker on ARM and it’s generally usable now with Lando but Docker I/O performance is still a hurdle.

I recommend upgrading to at least Docker 4.2.0 and using the experimental virtualization framework, otherwise you have significant and unnecessary overhead from qemu-system-aarch64. Others have reported slow I/O with it but at least in this version it’s the opposite for me.

Working with the M1 Pro is much nicer given how much the fan kicked on in Intel models, let alone running on battery, but it’s not the leapfrogging that other disciplines are seeing in their workloads with PHP.

One last thing to note is that these tests ran sequentially. The tests above can be processed in parallel for example with ParaTest but in my tests the differences between ARM and Intel only amplify there with 338 tests natively coming in at 1m59s on Intel with 16 threads while AARCH64 comes in at around 4m30s (experimental 03m03s).