Skip to content
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

High CPU usage by com.hyperkit.docker, above 20% with no containers running #5070

Closed
2 tasks done
rabkins opened this issue Nov 16, 2020 · 33 comments
Closed
2 tasks done

Comments

@rabkins
Copy link

rabkins commented Nov 16, 2020

  • I have tried with the latest version of my channel (Stable or Edge)
  • I have uploaded Diagnostics
  • Diagnostics ID: 4DC48EB2-7B74-4A83-82EC-93F9741B76C3/20201116103107

Expected behavior

Actual behavior

Information

  • macOS Version: 11.0.1

Diagnostic logs

Docker for Mac: 2.5.0.1 stable
i9 2,3 GHz

Steps to reproduce the behavior

  1. Install Docker
  2. Run Docker
@stephen-turner
Copy link
Contributor

@rabkins Do you have Kubernetes enabled? We know that has some CPU load.

@ebriney
Copy link
Member

ebriney commented Nov 16, 2020

@rabkins : In the diagnostic you provided, you have 4 running containers for 12% CPU which seems acceptable

@back-2-95
Copy link

back-2-95 commented Nov 17, 2020

I got this too.

  • clean install of Big Sur
  • Docker for Mac 2.5.0.1
  • checked with 6 containers running (all of them had barely any cpu usage)
  • com.docker.hyperkit is steady at 18-40% CPU

My Diagnostics ID: fa766d86-8e58-4125-b7fa-f43e69beb1f8/20201116185213

Update:
After 1st reboot, same thing but now 10-15% CPU.

@rabkins
Copy link
Author

rabkins commented Nov 17, 2020

@rabkins : In the diagnostic you provided, you have 4 running containers for 12% CPU which seems acceptable

@ebriney
This is diagnostics w/o any container running 4DC48EB2-7B74-4A83-82EC-93F9741B76C3/20201117055954
Kubernetes is disabled on my machine.

@kyloon
Copy link

kyloon commented Nov 17, 2020

I'm seeing the same high CPU usage behavior too without any container running and Kubernetes disabled running Docker for mac 2.5.0.1 on macOS Big Sur 11.0.1.

Diagnostic ID: 599659F8-1AF5-4EFC-A50B-8685A5A153F1/20201117071741

@slash686
Copy link

Same behavior - CPU usage is around 25% when no containers are running.

macOS Big Sur 11.0.1
MacBook Pro (16-inch, 2019)
2,3 GHz 8‑core Intel Core i9
16Gb

Diagnostic ID: 99E9079C-E84E-4D6F-9452-C57B91368BD6/20201117120837

@infolock
Copy link

This is the same issue reported here in #4994.

Also note that the energy impact issue is also still there. The only way to make it stop draining the battery on my laptop (while the power cable is plugged in!) is to either set the CPU cores down to 1 or just exit docker until the laptop can charge to 100% and try it again. Very frustrating.

Screen Shot 2020-11-17 at 11 08 32 PM

@infolock
Copy link

The next closest app that has this amount of Energy Impact is Chrome - and its energy impact (with over 20 tabs opened) is 10.2 lol

@JustinTArthur
Copy link

I see this on Mojave with 2.5.0.1 so it's not just Big Sur that's affected.

@robertrossmann
Copy link

robertrossmann commented Nov 19, 2020

Here is my diagnostic ID with hyperkit consuming around 20% CPU with no containers running and occasionally jumping to ~40% CPU with Redis & Postgres v9.6 containers running after receiving load from a test suite.

Diagnostic ID: 70E7E5DC-537D-45A7-A195-C291A623CB2A/20201119085501

Here is a sample of the hyperkit process captured in macOS 11. There is a weirdly deep stack calling camlLwt_main__run_loop_129, see the screenshots. This looks highly unhealthy... 🤔

deep stack trace - start
deep stack trace - end
Sample of com.docker.hyperkit.txt

@robinharms
Copy link

I have the same problem, running Catalina (pre big sur)

15-40% CPU usage without any running containers. No Kubernetes.

@N1gma
Copy link

N1gma commented Nov 19, 2020

Does some1 even working on this? Its literally impossible to use docker on mac - getting 300% CPU usage.

@Andorxor
Copy link

I've been using kde neon linux for a year now and never faced any issues with docker. Some folks persuaded me to switch to the shiny mac :) 70% of battery usage is due to docker. Most of the time with no containers.

@stephen-turner
Copy link
Contributor

Yes, we're working on this. We made a lot of improvements to the CPU recently, but it seems to have regressed again. We're not sure why: we suspect it's something in one of our upstream dependencies that has changed, but we're still looking into it.

@ptica
Copy link

ptica commented Nov 23, 2020

macOS Catalina 10.15.7
mac mini 6 core i5
8 gb
no container running, ±17-20% for com.docker.hyperkit

diagnostics uploaded:
F962E0A2-20E3-4F3A-B9F4-B3CC68973CE6/20201123163645

@eugene-s
Copy link

eugene-s commented Nov 25, 2020

macOS BigSur 11.0.1
MacBook Pro 13 core i5 2020
16 GB
no container running, ~30% CPU loading

image

@jahpola
Copy link

jahpola commented Nov 25, 2020

macOS Big Sur 11.0.1
MacBook Pro 16 i9 2019
16GB
No containers running, 10-20% cpu load

Diag id: 8A0107F8-1DD8-4D19-A714-53CED7C11B38/20201125204014

Sample of com.docker.hyperkit.txt

@stephen-turner
Copy link
Contributor

Update: We've pinpointed this to the new Linux kernel we took between 2.4 and 2.5. We see the CPU load of a supposedly idle system double across that boundary.

This conversation is currently going on in two tickets. I'm going to combine them by closing this one in favour of #5044. Please follow that ticket for updates. Thanks.

@tomchapin
Copy link

My battery keeps slowly draining all day even when it is plugged in, often running completely out of battery and dying before I even reach 5 PM. The only solution that worked was to kill programs that were using excess energy (such as Docker).

I finally called Apple support about the issue and they revealed to me that the new macbook pro laptops are designed to pull energy from the battery whenever the CPU needs extra power. So the charger only provides 96 watts, but the laptop can boost to higher wattage usage when needed, and when it does so, it pulls this extra wattage from the battery.
Unfortunately, they told me that this behavior was automatic and there was no way to disable it.

I did a little bit of digging, however, and I discovered a tool called “Turbo Boost Switcher” that allows you to toggle off Turbo Boost on your mac. http://tbswitcher.rugarciap.com/

The moment I disabled Turbo Boost, my macbook battery amperage draw went from -187 (slowly draining the battery) up to +138 (slowly charging the battery).

I believe I have finally fixed the problem! Unfortunately, this means I have to throttle my laptop so it doesn’t run as fast, which is annoying… but at least it shouldn’t die on me anymore, hopefully…

@NaeemSohrabi
Copy link

Hi,
i have the same problem of high cpu usage abut 320 to 350 %
OS : Big Sur 11.1.
Docker: 3.0.2

docker-compose.yml

version: "3.2"

services:
  node:
    build:
      dockerfile: node_watch.Dockerfile
      context: ./logger
      args:
        REGISTRY_URI: ${REGISTRY_URI}
    volumes:
      - ./logger/public/:/var/www/logger/public/
      - ./logger/resources/:/var/www/logger/resources/
      # - ./logger/node_modules:/var/www/logger/node_modules
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro
    container_name: node
    networks:
      - mavara-network

  laravel_echo_server:
    build:
      dockerfile: Dockerfile
      context: ./echo
      args:
        REGISTRY_URI: ${REGISTRY_URI}
    restart: unless-stopped
    container_name: laravel_echo_server
    volumes:
      - ./echo/laravel-echo-server.json:/opt/echo/laravel-echo-server.json
      - ./echo/certs:/opt/echo/certs/
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro

    ports:
      - 6001:6001
    depends_on:
      - php
      - redis
    networks:
      - mavara-network

  mysql:
    image: ${REGISTRY_URI}/mysql:5.7
    container_name: mysql
    restart: unless-stopped
    volumes:
      - ./mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
      - ./mysql/data:/var/lib/mysql
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro
    env_file: ./mysql/.env
    networks:
      - mavara-network

  nginx:
    image: ${REGISTRY_URI}/nginx:1.19.2
    container_name: nginx
    restart: unless-stopped
    volumes:
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
      - ./logger/:/var/www/logger
      - ./nginx/cert:/etc/nginx/certs/
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro
    ports:
      - 80:80
      - 443:443
    depends_on:
      - php
    networks:
      - mavara-network

  redis:
    image: ${REGISTRY_URI}/redis:6.0.8
    container_name: redis
    restart: unless-stopped
    networks:
      - mavara-network
    volumes:
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro

  php:
    restart: unless-stopped
    build:
      dockerfile: php_dev.Dockerfile
      context: ./logger
      args:
        REGISTRY_URI: ${REGISTRY_URI}
    container_name: php
    hostname: php
    environment:
      SOURCE_DIR: ${SOURCE_DIR}
      HOST_USER: ${HOST_USER}
      HOST_ADDR_NAME: ${HOST_ADDR_NAME}
    volumes:
      - ./logger/local.ini:/usr/local/etc/php/conf.d/local.ini
      - ./logger/:/var/www/logger/
      - ~/.ssh/:/root/.ssh/
      - /etc/sudoers:/var/www/logger/sudoers
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro
    env_file:
      - ./logger/.env.dev
    depends_on:
      - mysql
      - redis
    networks:
      - mavara-network

  snmp-server:
    build:
      dockerfile: Dockerfile
      context: ./snmp
      args:
        REGISTRY_URI: ${REGISTRY_URI}
    restart: unless-stopped
    container_name: snmp-server
    volumes:
      - /proc:/proc
      - ./snmp/snmpd.conf:/etc/snmp/snmpd.conf
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/timezone:/etc/timezone:ro
      - /Users/naiemsohrabi/Documents/Project/Docker/Mavara/localtime:/etc/localtime:ro
    networks:
      - mavara-network
  reporter:
    restart: unless-stopped
    build:
      context: ./pdf-reporter
      args:
        REGISTRY_URI: ${REGISTRY_URI}
    container_name: reporter
    networks:
      - mavara-network
# Docker Networks
networks:
  mavara-network:
    driver: bridge

@eugene-s
Copy link

eugene-s commented Dec 22, 2020

For now, my solution is using multipass tool to install VM based on Ubuntu then I installed Docker to it and it works properly. Yes, there's a problem with path mounting, but multipass has support for that. The problem is it uses SSH for everything. I don't need path-mapping and SSH is enough for me. CPU usage with no containers no more than 2%. (2 CPUs, RAM 4Gb). When I've started a few containers (postgres, redis), it doesn't use a lot of resources, about 7%. But RabbitMQ uses a bit high CPU, that hyperkit process uses about 10% of CPU, and I very like that.

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                                         NAMES
3ff3a0a11f61        redis         "docker-entrypoint.s…"   12 days ago         Up 2 minutes        0.0.0.0:6379->6379/tcp                                                                                        redis
d3873f08a1e5        rabbitmq      "docker-entrypoint.s…"   12 days ago         Up 2 minutes        4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   rabbitmq
c374e91e07be        postgres      "docker-entrypoint.s…"   12 days ago         Up 2 minutes        0.0.0.0:5432->5432/tcp                                                                                        postgres
CONTAINER ID        NAME                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
3ff3a0a11f61        redis          0.32%               8.082MiB / 3.844GiB   0.21%               1.31kB / 0B         10.4MB / 0B         3
d3873f08a1e5        rabbitmq       0.66%               100.6MiB / 3.844GiB   2.56%               1.31kB / 0B         35.3MB / 53.2kB     88
c374e91e07be        postgres       0.00%               10.7MiB / 3.844GiB    0.27%               1.31kB / 0B         25.8MB / 69.6kB     6
root             85482   6.8  3.1  8654084 518436   ??  S    11:59AM   1:02.38 /Library/Application Support/com.canonical.multipass/bin/hyperkit -c 2 -m 4096M -u -A -H -U 386bba5a-5dc4-3ac2-95c9-cf0b9a29b352 -s 0:0,hostbridge -s 2:0,virtio-net -s 5,virtio-rnd -s 31,lpc -l com1,autopty=/var/root/Library/Application Support/multipassd/vault/instances/primary/pty,log=/Library/Logs/Multipass/primary-hyperkit.log -s 1:0,virtio-blk,file:///var/root/Library/Application Support/multipassd/vault/instances/primary/ubuntu-20.04-server-cloudimg-amd64.img?sync=os&buffered=1,format=qcow,qcow-config=discard=true;compact_after_unmaps=262144;keep_erased=262144;runtime_asserts=false -s 1:1,ahci-cd,/var/root/Library/Application Support/multipassd/vault/instances/primary/cloud-init-config.iso -f kexec,/var/root/Library/Application Support/multipassd/vault/instances/primary/ubuntu-20.04-server-cloudimg-amd64-vmlinuz-generic,/var/root/Library/Application Support/multipassd/vault/instances/primary/ubuntu-20.04-server-cloudimg-amd64-initrd-generic,earlyprintk=serial console=ttyS0 root=/dev/vda1 rw panic=1 no_timer_check

image

And when no containers I see this picture:
image

Multipass uses the same VM as Docker. But Docker takes more resources...

@markovanderpuil
Copy link

I'm on Mojave. Fresh install. Zero containers ~%39 cpu load. Docker supervisor 35,5 Energy impact. Tell me what you need to fix this for once and for all. Also a lot of network calls and I have disabled all the phone home settings. Probably not legal in Europe.

@pkubanek
Copy link

Big Sur 11.1. Dockers shows > 100% in top on 8 core system just right after starting it up, without any container running.

@pkubanek
Copy link

Big Sur 11.1. Dockers shows > 100% in top on 8 core system just right after starting it up, without any container running.

Switching off "Use gRPC FUSE for file sharing" in Preferences/Experimental dropped Docker to ~ <6% CPU when no container is running.

image

@esprit-dev
Copy link

Switching off "Use gRPC FUSE for file sharing" in Preferences/Experimental dropped Docker to ~ <6% CPU when no container is running.

The same here.... drop from ~20% to ~5%

@betesh-at-data-axle
Copy link

This did not work for me. I'm not sure if it's the same issue though--What I'm seeing is that Docker.raw very quickly fills the allotted disk space during a docker build and then CPU of hyperkit spikes to the maximum number of cores allowed, stays there indefinitely, and the build hangs.

@Oceanbao
Copy link

Oceanbao commented Feb 6, 2021

Switching off "Use gRPC FUSE for file sharing" in Preferences/Experimental dropped Docker to ~ <6% CPU when no container is running.

Confirming this works, dropped from ~20% to 6%.

@fbrousse
Copy link

For me disabling gRPC did nothing, however stopping Kubernetes docker included makes a drop from 42% to 4%.

MBP Core i7 / Docker 3.1.0

@snipem
Copy link

snipem commented Feb 26, 2021

Not using lazydocker brought down the CPU usage from 300% to ~5%

@bltDefender
Copy link

Big Sur 11.2.2 disabling all experimental functions decreases CPU usage to 15% using 14 threads. Kubernetes not being active. Still on top 3 cosumers on my system.

@sinland
Copy link

sinland commented Apr 3, 2021

Big Sur 11.1. Dockers shows > 100% in top on 8 core system just right after starting it up, without any container running.

Switching off "Use gRPC FUSE for file sharing" in Preferences/Experimental dropped Docker to ~ <6% CPU when no container is running.

image

Confirming this works, dropped from ~120% to ~5%.

@ZhaoZuohong
Copy link

The same for me. After switching from gRPC FUSE to legacy osxfs, CPU usage dropped from 22% to 6%.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

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.
/lifecycle locked

@docker docker locked and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests