-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Apple Silicon, M1] Low database (MariaDB) performance, projects feel generally sluggish and slow #5389
Comments
Thank you for the report, @slashrsm. There are known issues with disk speed on write-heavy workloads, which we are already talking to Apple about. There are two more things that would be interesting to test if you are so inclined.
Both of these would suggest that it is a MacOS problem rather than a Docker problem. |
@stephen-turner Thank you.
I will try and report back.
I did try it for some of the benchmarks (Gzip and database import) and the performance was comparable to hypervisor.framework build. |
@rfay Suggested to add benchmark for Drupal 9 Umami database dump (also publicly available), so I added that. |
@stephen-turner Excuse me, but it turns out that I didn't enable the experimental
|
I managed to test the database import in a bare Import into MariaDB: 2m15.416s Ubuntu 20.04 comes with MariaDB 10.3, while I used 10.5 in my previous benchmarks. I am not sure why it is even slower, but it could be to the older version. It does seem that the problem is in the |
Thanks for that, @slashrsm, that's really helpful. I think that confirms our suspicions. As I said above, we've talked to Apple about this too. We're also wondering if we can speed it up by flushing less often: there would be a slight risk of lost data if there was a power cut or something, but in a development context that might be an acceptable trade-off. cc @djs55 for visibility |
This is really quite an amazing slowness on a system that in most ways is way faster than anything else. Such a surprise every time I import a database to see it run about 10x slower than amd64. |
I don't think this is specific to database performance, Just experienced this myself where it took 484 seconds to chmod a NodeJS + PHP project consisting of 450 MB in extracted packages. Pinging a static webpage running inside of the docker container using
|
It seems to be related to slow I/O in some cases. It is listed under known issues for the latest preview. |
Using tmpfs helps a lot, which may be useful for development purposes at least. Here is a comparison of running a pgBackRest integration test (which runs Postgres instances) on Intel (2020 iMac) and M1 (2020 Air):
normal:
tmpfs:
|
Just a happy note that @djs55 's current experimental build seems to have a huge effect on this issue as well. Massively faster to do a db import. See #5476 (comment) |
Thanks, @rfay, that's very interesting. |
Everyone watching this thread, please try the new RC2 build at https://docs.docker.com/docker-for-mac/apple-m1/ and give us feedback whether it solves this problem (and whether it causes any new problems!). Thank you. |
Just tried the RC2 and first impressions are very good – test suite now runs faster than on Intel, previously it was 10x slower or more. Will report back if any other problems become apparent! |
Yes, that helps a lot. Here is the updated comparison of running a pgBackRest integration test (which runs Postgres instances) on Intel (2020 iMac) and M1 (2020 Air):
normal:
tmpfs:
There is one problem I noticed however.
I had to fix this before I could run our tests with:
Presumably this has something to do with |
Thanks @dwsteele, we'll look into the /dev/null issue. |
RC2 is way faster for me. Apple M1 MacBook Pro 16GB RAM Resources
Import of an 2GB Database:
This is a huge improvement for me. Edit: PHPUnit tests with a lot I/O (sqlite Fixtures) in an not mounted folder
Again big improvement. thx alot |
Thanks for the new release, it's a massive improvement. The time taken for a Python test suite to run is equivalent between using tmpfs and a volume with RC2, whereas using a volume on prior versions would take perhaps 10 times as long to run. |
I can also confirm that I saw a massive improvement with RC2 on qemu. |
@dwsteele thanks for your report. I'm perplexed by the
The strange thing is that the choice of hypervisor ( |
@djs55 I have attached the Dockerfile. We are testing this for dev purposes on Intel/M1 Macs (currently we use Vagrant/VirtualBox on Intel). It's pretty unconventional but worked OK until the issue with the qemu-based M1 Docker. |
Is this considered a hybrid emulation approach? Is there a potential future release that would try to utilize BigSur's virtualization.framework? |
@rovo79 The previous builds all used virtualization.framework: this build allows you to swap between qemu and virtualization.framework. |
I've updated my Docker installation to RC2 and database performance has improved drastically. |
Overall this feels snappier, but applying Postgres migrations is still really slow to the point that my project doesn't even boot (it boots after all migrations are applied, but I manually stop it at 30m since there is no point waiting more than a couple of minutes). Migrations create more than 140 tables, they also add and remove some columns. I have tried both with "Use new virtualization framework" option enabled and disabled. I also completely uninstalled Docker (using the Uninstall option from the menu, then dragging the app to the trash can) before installing RC2. |
I have to say that my experience has been quite the opposite with regards to Postgres, although I don't have anywhere near as many tables as that (only 35). Prior to RC2, the migrations would take 1-2 minutes, but now it's 1-2 seconds. One thing I have noticed though, is that RC2 has a much more significant impact on battery life. I assume this is because virtualization.framework is well optimized in this regard vs QEMU? |
Probably, yes. We have noticed slightly higher CPU with qemu. |
I just downloaded Preview RC3 and I have still issues running migrations in apple silicon. |
@stephen-turner GA 3.3.1 fixed the issue I had with |
I'm going to close this ticket now. The original issue is fixed by making virtualization framework no longer the default. |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Information
I have a bunch of client projects (PHP, mostly Drupal, some Laravel and Symfony) are we standardized on DDEV local environment. After switching from 2018 i7 MBP to M1 MacBook Air I noticed that my projects feel generally slower than before. I noticed that database imports take way longer than they used to, so I decided to investigate and compare performance between the two machines. I did make sure that M1 runs arm64 images. Here are the benchmarks that I performed:
mariadb:latest
image. Since I can't share client databases, I found an employees sample database online (with some unit tests) and created fresh Drupal install with some generated content and exported the database. EDIT: Added benchmarks for imports of Drupal 9 Umami dump.Docker.dmg
of latest Apple Silicon preview and gzipped it:gzip -c Docker.dmg > /dev/null
M1 is not always slower. For single-threaded CPU and memory heavy tasks it is consistently twice as fast as Intel. But it can get slow in more complex situations. I suspect the database, but even there the results are not consistent. For some datasets it performs very well and for some it gets very slow.
In two cases where database performance was much slower on M1 I tried to do the same operation using the database server running on host machine. In both cases it was significantly faster.
EDIT: I tried Drupal 9 Umami import (benchmark 3.) on Intel with experimental
virtualization.framework
and was able to reproduce performance regression that I see on M1.EDIT 2: It seems that the problem is indeed in the
virtualization.framework
and not in Docker. See this comment for more info.Apple Silicon MacBook Air (latest docker - build 60984, DDEV 1.17.0-alpha6)
2015 MBP, i7 2,6Ghz, hexa-core (latest docker - build 51484, DDEV 1.17.0-alpha6):
hypervisor.framework
: 3.129svirtualization.framework
: 1m 41.14sSteps to reproduce the behavior
There are some tests that are not reproducible as they related to the specific client projects. But I did manage to create a few benchmarks where the scripts and datasets are available to everyone. Those are items nr. 2, 3, 4, 5, 6, 10 and 11.
The text was updated successfully, but these errors were encountered: