Skip to content

[Docker Desktop] Investigate Mac CPU performance #12

Closed

Description

@nebuk89

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

Are you currently working around this issue?
N/A
Additional context
N/A
Attachments
docker/for-mac#1759
docker/for-mac#3499
docker/for-mac#2601

Activity

  1. added
    docker_desktop
    on Mar 16, 2020
  2. cculianu commented on Apr 4, 2020

    @cculianu

    Please add docker/for-mac#4392 to this list.

  3. nebuk89 commented on Apr 6, 2020

    @nebuk89
    ContributorAuthor

    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!

  4. schellj commented on Apr 14, 2020

    @schellj
  5. mc0 commented on May 7, 2020

    @mc0

    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:

    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.
    
  6. daveisfera commented on May 7, 2020

    @daveisfera

    See this on why mounts use lots of CPU.

    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?

  7. m8rge commented on May 8, 2020

    @m8rge

    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

  8. nebuk89 commented on May 11, 2020

    @nebuk89
    ContributorAuthor

    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 :)

  9. alechirsch commented on May 16, 2020

    @alechirsch

    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.

     - volumes
        - ./:/src
        - /src/node_modules
        - ./node_modules/express:/src/node_modules/express
    
  10. andig commented on Jun 4, 2020

    @andig

    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.

  11. schellj commented on Jun 4, 2020

    @schellj

    I've also had times where the Docker process was using 100% CPU indefinitely when no containers were running.

  12. ebriney commented on Jun 18, 2020

    @ebriney
    Member

    @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

  13. schellj commented on Jun 18, 2020

    @schellj

    @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).

  14. haslo commented on Jun 26, 2020

    @haslo

    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.

  15. 94 remaining items

  16. deleted a comment from daveisfera on Sep 30, 2020
  17. pederkronsgaard commented on Oct 1, 2020

    @pederkronsgaard

    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)

  18. andig commented on Oct 1, 2020

    @andig

    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?

  19. rfay commented on Oct 1, 2020

    @rfay

    @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.

  20. sdbruder commented on Oct 1, 2020

    @sdbruder

    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).

  21. aleks-rope commented on Oct 2, 2020

    @aleks-rope

    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.

  22. KhaledMohamedP commented on Oct 5, 2020

    @KhaledMohamedP

    Yes! this is a giant improvement!!!
    Thanks everyone for working on this upgrade 🎊 🙏

  23. PhilETaylor commented on Oct 5, 2020

    @PhilETaylor

    And even works on MacOS Big Sur ;-)

  24. rpkoller commented on Oct 5, 2020

    @rpkoller

    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?

  25. nebuk89 commented on Oct 8, 2020

    @nebuk89
    ContributorAuthor

    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!

  26. sashaaKr commented on Apr 12, 2021

    @sashaaKr

    @nebuk89 can you share link to blog post if it was written?

  27. stephen-turner commented on Apr 12, 2021

    @stephen-turner

    @sashaaKr Unfortunately we never got round to writing the blog post.

  28. moved this to Shipped! Enjoy! in docker-roadmapon May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docker_desktop

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions