You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Docker Desktop] Investigate Mac CPU performance #12
Tell us about your request
CPU performance on Mac is a long standing issue, we have investigated this in the past but want to dedicate time to re-invetsigate this and try and find a fix
Which service(s) is this request for?
Desktop
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
We keep spiking to 100% CPU and this isn't good, no one likes their laptop taking off
Reacted by sureshsankaran, beeman, Joan Zapata, Sid Choudhury, Waheed Barghouthi, Pavlo M., Dave Johansen, Aleksey Shein, Jesús Antonio Canales Diez, Paweł Piątkowski and 348 more
Reacted by Brian Harrington, Ralf Koller, Leandro Grillo, Dave Johansen, Dave Johansen, Stephen Connolly, eu, Alex Ellwein, Alex Oliveira, Dmitrii Kotov and 29 more
Reacted by Brian Harrington, Simon Mönch, Leandro Grillo, Stephen Connolly, eu, Alex Ellwein, Alex Oliveira, Dmitrii Kotov, Philip, Saleem and 21 more
Reacted by tris, Luke Urban, Jared Rypka-Hauer, Alex Danescu, Igor Sloboda, Benjamin Wood, JC Frane, Tomer Golan, Jeff, Tim Fehr and 12 more
Reacted by Dave Johansen, Dave Johansen, eu, Dmitrii Kotov, Philip, Saleem, Jeff Julian Goes, Branko Djurkovic, Luke Urban, Aðalsteinn Rúnarsson and 17 more
Thanks @aguedeney and @cculianu - when we move this into in progress I will link back the tickets we are using in for-mac to highlight where we will be discussing with everyone and also where we will be seeking fresh logs for issues :) please feel free to add other cases here as you think appropriate!
The primary issue with CPU that I have seen relates to volume mounts, transfused, and heavy IO workloads. I have observed this a lot of times and inside the VM it is usually transfused using the CPU.
A Linux system call such as open or read that accesses bind-mounted files in a container must be.
- turned into a FUSE message in the Linux VFS
- proxied over a virtio socket by transfused
- forwarded onto a UNIX domain socket by HyperKit
- deserialized, dispatched and executed as a macOS system call by osxfs
The entire process then takes place in reverse to return the result of the macOS system call to the container.
This definitely makes sense for bind mounts because it's having to go in and out of the VM to interface with the host filesystem, but I'm still seeing high CPU usage after we switched to using named volumes and that should all be inside of the VM, but I'm still seeing high CPU usage when things are sitting idle, so is there any similar :cached/:delegated tags for named volumes to help with performance issues there?
This issue is too broad. Some people may suffer from mounts CPU performance, but other have 100% cpu after prune command in this issue: docker/for-mac#4064
Thanks to all the responses!
We will start our investigation on this in the next ~2 weeks!
Watch out for incoming questions on some of the for-mac issues. We won't respond to posts in here with logs etc but will use this to share updates as we make progress :)
Reacted by Ralf Koller, Jarek Radosz, Sebastian, Jiří Šebek, Shawn Smith, James Woodall, Mark Cobalt, Danny Shemesh, Pablo Baeyens, Serhii Zolotov and 4 more
Reacted by Ralf Koller, Sebastian, Alesso, Carlos Moro, Serhii Zolotov, Peter Becich and Di0niz
Reacted by Sebastian, Andrey, Weston Ruter, Charlie Wilkins, Matthieu Beauché, Greg Annandale, Calvin Young, Serhii Zolotov and Peter Becich
I was running into CPU issues as well and noticed something weird happening with volumes.
I created three volumes in my compose file, one for the project directory, one to ignore node_modules, and another to mount a specific node_module.
It works as expected, a file from the specific node_module that I modified locally was copied to the container. Likewise I modified a file in another node_module and the change was not copied to the container. Everything works fine.
The issue came when I did a docker-compose restart, the other node_module that should have been ignore was copied into the container, and my laptop fans were taking off. Every file in node_modules after that point was copied over to the container even though I specified it not to.
I did investigating a few months ago so the reproduction steps might be off, but there was definitely an issue with volumes copying files that it was not supposed to.
I would like to highlight that docker/for-mac#3499 (comment) has a concrete suspicion of potentially bugged code that might be easy to investigate (with OCAML knowledge).
The primary issue with CPU that I have seen relates to volume mounts, transfused, and heavy IO workloads. I have observed this a lot of times and inside the VM it is usually transfused using the CPU.
I would also like to add that this is not the only cause. I do sometimes see docker spike to at remain at 100% without any containers running. Definitely no high IO workload in that case, pure "home" usage.
I've also had times where the Docker process was using 100% CPU indefinitely when no containers were running.
Reacted by andig, Randy Fay, James Woodall, Di0niz, Moises Rodriguez, dietervdw-spotify, Dmitry Makarenko, Brian McDonnell, rndrr, Bart Karp and 3 more
@schellj , can you do a diagnose when it happens? (if the whale menu is responding of course).
I you cannot use the UI, you can still do it with cli command: /Applications/Docker.app/Contents/MacOS/com.docker.diagnose gather -upload
I just upgraded to 2.4 for Mac and CPU usage is a lot better for the app I'm running! The code is mounted inside the container during development and the app checks all relevant files (769 atm.) for changes every 5 seconds in order to auto reload. This usually caused a good spike in CPU usage up to around 50% CPU. Now there's a consistently low usage, mostly below 5%, when checking every second!
So I can confirm that IO performance and CPU usage have improved a lot in this update in my case.
Tested on: MacBook Pro (13-inch, 2017, 2,3 GHz Intel Core i5)
Reacted by Elliot Wright, dschuessler, Roberto Fierros Zepeda and Nik Gomez
@andig 2.4.0.0 is latest in Stable. 2.3.7.0 was never in Stable and never will be. See the Stable Release Notes for how to download any stable version. Note that you will lose all containers and volumes switching from edge to stable.
I've upgraded to 2.4.0.0 and got a lot of ERROR: for <container-name> UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60) in our complex local dev stack, we instructed all devs to revert to the previous version which solved the issue (for now).
I have updated Docker to 2.4.0 the CPU usage seems to be lower (now only around 10-12%) and everything has been running smooth so far on my MacBook Pro 2.8 GHz Quad-Core Intel Core i7.
hm the 2.4.0 build was behaving well so far without any fans running extensively all of a sudden without an apparent reason. but today after starting a project and leaving the computer for half an hour, just started up a project in DDEV right before, when i returned the fans were running on max and the cpu was spiking without a stop. :/
setup: macos 10.13.6 on a mbp 13" early 2011 8GB RAM with docker desktop 2.4.0 running a Drupal site with DDEV. i've sampled the .com.docker.backend process which was constantly at +/- 100% and com.docker.hyperkit which was around 10 to 30%... the samples: samples.zip
p.s. and according to the deprecation notice for high sierra on the first startup of the minor 2.4.0 release it was the last release for macos 10.3 so no 2.4.x bug fix release anymore?
We have now shipped the changes from our investigation over the last 3 months as part of the 2.4 Desktop release.
This does not mean we have got all of the bugs potentially causing this (we fixed a new one yesterday! ) but it is the point where we are no longer going to be driving a significant investigation into multiple potential root causes to this.
We will do a blog post in a few weeks detailing the things we found/changes we made to give you some insight into what we did and why.
If you are still having issues, I would ask that you create new tickets on for-mac rather than comment on old tickets as we are going to close these to keep our backlog a bit tidier and not mix up the messages (and it is easier for us to get signal on the scale of issues this way).
Thanks again for your patience and an even bigger thank you to all of you who took the time to test builds & upload diagnostics!
Reacted by Jay Fuqua, Genís, Michael Bøcker-Larsen, Stav Alfi, Ray Lee, Serhii Fomenko, Ivan Bisevac (Иван Бишевац), Roman Stepanchuk, Zero King, mr-mare and 1 more
Reacted by Cihan Boz, Pablo Padilla, Martin F and burak
Reacted by Arno Schutijzer, Tomasz Wójcik, nm777, Lucas Chabert, Sebastian, Jarosław Siedlarz, Yoshimasa Tanabe, Jason, Aleksandr Fisun and Andrii Soluk
Activity
cculianu commentedon Apr 4, 2020
Please add docker/for-mac#4392 to this list.
nebuk89 commentedon Apr 6, 2020
Thanks @aguedeney and @cculianu - when we move this into in progress I will link back the tickets we are using in for-mac to highlight where we will be discussing with everyone and also where we will be seeking fresh logs for issues :) please feel free to add other cases here as you think appropriate!
schellj commentedon Apr 14, 2020
Please add docker/for-mac#4064.
mc0 commentedon May 7, 2020
The primary issue with CPU that I have seen relates to volume mounts, transfused, and heavy IO workloads. I have observed this a lot of times and inside the VM it is usually transfused using the CPU.
See this on why mounts use lots of CPU. Namely:
daveisfera commentedon May 7, 2020
This definitely makes sense for bind mounts because it's having to go in and out of the VM to interface with the host filesystem, but I'm still seeing high CPU usage after we switched to using named volumes and that should all be inside of the VM, but I'm still seeing high CPU usage when things are sitting idle, so is there any similar
:cached/:delegatedtags for named volumes to help with performance issues there?m8rge commentedon May 8, 2020
This issue is too broad. Some people may suffer from mounts CPU performance, but other have 100% cpu after prune command in this issue: docker/for-mac#4064
nebuk89 commentedon May 11, 2020
Thanks to all the responses!
We will start our investigation on this in the next ~2 weeks!
Watch out for incoming questions on some of the for-mac issues. We won't respond to posts in here with logs etc but will use this to share updates as we make progress :)
alechirsch commentedon May 16, 2020
Hope this helps in some way.
I was running into CPU issues as well and noticed something weird happening with volumes.
I created three volumes in my compose file, one for the project directory, one to ignore node_modules, and another to mount a specific node_module.
It works as expected, a file from the specific node_module that I modified locally was copied to the container. Likewise I modified a file in another node_module and the change was not copied to the container. Everything works fine.
The issue came when I did a
docker-compose restart, the other node_module that should have been ignore was copied into the container, and my laptop fans were taking off. Every file in node_modules after that point was copied over to the container even though I specified it not to.I did investigating a few months ago so the reproduction steps might be off, but there was definitely an issue with volumes copying files that it was not supposed to.
andig commentedon Jun 4, 2020
I would like to highlight that docker/for-mac#3499 (comment) has a concrete suspicion of potentially bugged code that might be easy to investigate (with OCAML knowledge).
I would also like to add that this is not the only cause. I do sometimes see docker spike to at remain at 100% without any containers running. Definitely no high IO workload in that case, pure "home" usage.
schellj commentedon Jun 4, 2020
I've also had times where the Docker process was using 100% CPU indefinitely when no containers were running.
ebriney commentedon Jun 18, 2020
@schellj , can you do a diagnose when it happens? (if the whale menu is responding of course).
I you cannot use the UI, you can still do it with cli command:
/Applications/Docker.app/Contents/MacOS/com.docker.diagnose gather -uploadschellj commentedon Jun 18, 2020
@ebriney I haven't had any issues with Docker for Mac using a lot of CPU unexpectedly since early May - see docker/for-mac#4064 (comment), but I did a couple of diagnostics when I was - see docker/for-mac#4064 (comment) and docker/for-mac#4064 (comment) (I made some other relevant comments in that issue as well).
haslo commentedon Jun 26, 2020
I installed the edge build (with spindump) and uploaded this diagnostic:
0D3FCEE0-663F-4A5E-8DA2-1B79B6746B54/20200626175354
The Kubernetes containers were running (with nothing to manage), nothing from my side, and Docker used 50% CPU.
94 remaining items
pederkronsgaard commentedon Oct 1, 2020
I just upgraded to 2.4 for Mac and CPU usage is a lot better for the app I'm running! The code is mounted inside the container during development and the app checks all relevant files (769 atm.) for changes every 5 seconds in order to auto reload. This usually caused a good spike in CPU usage up to around 50% CPU. Now there's a consistently low usage, mostly below 5%, when checking every second!
So I can confirm that IO performance and CPU usage have improved a lot in this update in my case.
Tested on: MacBook Pro (13-inch, 2017, 2,3 GHz Intel Core i5)
andig commentedon Oct 1, 2020
I'm still getting 2.3.7.0 as latest release, both on stable and edge channel. What's needed to get 2.4 to install?
rfay commentedon Oct 1, 2020
@andig 2.4.0.0 is latest in Stable. 2.3.7.0 was never in Stable and never will be. See the Stable Release Notes for how to download any stable version. Note that you will lose all containers and volumes switching from edge to stable.
sdbruder commentedon Oct 1, 2020
I've upgraded to 2.4.0.0 and got a lot of
ERROR: for <container-name> UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)in our complex local dev stack, we instructed all devs to revert to the previous version which solved the issue (for now).aleks-rope commentedon Oct 2, 2020
I have updated Docker to 2.4.0 the CPU usage seems to be lower (now only around 10-12%) and everything has been running smooth so far on my MacBook Pro 2.8 GHz Quad-Core Intel Core i7.
KhaledMohamedP commentedon Oct 5, 2020
Yes! this is a giant improvement!!!
Thanks everyone for working on this upgrade 🎊 🙏
PhilETaylor commentedon Oct 5, 2020
And even works on MacOS Big Sur ;-)
rpkoller commentedon Oct 5, 2020
hm the 2.4.0 build was behaving well so far without any fans running extensively all of a sudden without an apparent reason. but today after starting a project and leaving the computer for half an hour, just started up a project in DDEV right before, when i returned the fans were running on max and the cpu was spiking without a stop. :/
setup: macos 10.13.6 on a mbp 13" early 2011 8GB RAM with docker desktop 2.4.0 running a Drupal site with DDEV. i've sampled the .com.docker.backend process which was constantly at +/- 100% and com.docker.hyperkit which was around 10 to 30%... the samples:
samples.zip
p.s. and according to the deprecation notice for high sierra on the first startup of the minor 2.4.0 release it was the last release for macos 10.3 so no 2.4.x bug fix release anymore?
nebuk89 commentedon Oct 8, 2020
Hey all,
We have now shipped the changes from our investigation over the last 3 months as part of the 2.4 Desktop release.
This does not mean we have got all of the bugs potentially causing this (we fixed a new one yesterday! ) but it is the point where we are no longer going to be driving a significant investigation into multiple potential root causes to this.
We will do a blog post in a few weeks detailing the things we found/changes we made to give you some insight into what we did and why.
If you are still having issues, I would ask that you create new tickets on for-mac rather than comment on old tickets as we are going to close these to keep our backlog a bit tidier and not mix up the messages (and it is easier for us to get signal on the scale of issues this way).
Thanks again for your patience and an even bigger thank you to all of you who took the time to test builds & upload diagnostics!
sashaaKr commentedon Apr 12, 2021
@nebuk89 can you share link to blog post if it was written?
stephen-turner commentedon Apr 12, 2021
@sashaaKr Unfortunately we never got round to writing the blog post.