Hyperkit process on MacOS continuously using approx 50% CPU
Expected behavior
With no user workload / containers running, expect CPU usage to be very low.
Actual behavior
"hyperkit" process using aprox. 50% CPU all the time
Information
Diagnostics ID: 1582F6B0-78F2-4F39-9BDC-67E37D52D34B
Steps to reproduce the behavior
- Install Docker for Mac (Edge, with Kubernetes enabled)
- Check hyperkit CPU usage in Activity Monitor
I've also seen the memory usage at the top. About 1.85 GB. Not sure if it is normal.
Still happening on Docker version 18.03.0-ce, build 0520e24
Any updates on this? It's a little bit of a blocker for me to keep this on all the time. It drains my laptop battery when unplugged.
I think it went away when i shut down a container I forgot about.
This urgently needs to be fixed. It's important to note that while there are many issues about Docker for Mac consuming an insane amount of CPU, those reports seem to be related to actual workloads. But this issues when there are no containers running (other than Kubernetes itself). A simple reset and restart will trigger the problem.
Looking at the actual VM, this seems like a typical distribution of CPU usage among the Kubernetes processes:
18774 18757 root S 153m 4% 0 7% kube-controller-manager --kubeconf
1130 1015 root S 787m 20% 0 6% /usr/local/bin/dockerd -H unix:///
1016 906 root S 247m 6% 0 4% kubelet --kubeconfig=/etc/kubernet
11142 11124 root S 721m 18% 0 3% kube-apiserver --advertise-address
14329 14312 root S 53468 1% 0 1% kube-scheduler --address=127.0.0.1
First, looking at the logs, something is continuously calling Docker's API with requests such as /v1.31/containers/json. I'm going to assume this is the Kubelet. But the Kubelet doesn't log any activity corresponding to the frequency of requests, and neither does kube-controller-manager. apiserver does log a little bit:
2018-05-28T19:03:15.431464400Z I0528 19:03:15.431266 1 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.compose.docker.com
2018-05-28T19:03:16.387777600Z E0528 19:03:16.387645 1 controller.go:111] loading OpenAPI spec for "v1beta1.compose.docker.com" failed with: OpenAPI spec does not exists
2018-05-28T19:03:16.388078600Z I0528 19:03:16.387994 1 controller.go:119] OpenAPI AggregationController: action for item v1beta1.compose.docker.com: Rate Limited Requeue.
2018-05-28T19:03:17.368711500Z I0528 19:03:17.368437 1 controller.go:105] OpenAPI AggregationController: Processing item v1beta2.compose.docker.com
2018-05-28T19:03:17.371758900Z E0528 19:03:17.371636 1 controller.go:111] loading OpenAPI spec for "v1beta2.compose.docker.com" failed with: OpenAPI spec does not exists
2018-05-28T19:03:17.372081200Z I0528 19:03:17.372001 1 controller.go:119] OpenAPI AggregationController: action for item v1beta2.compose.docker.com: Rate Limited Requeue.
2018-05-28T19:04:16.316600800Z I0528 19:04:16.316422 1 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.compose.docker.com
2018-05-28T19:04:16.321664900Z E0528 19:04:16.321553 1 controller.go:111] loading OpenAPI spec for "v1beta1.compose.docker.com" failed with: OpenAPI spec does not exists
2018-05-28T19:04:16.321878200Z I0528 19:04:16.321822 1 controller.go:119] OpenAPI AggregationController: action for item v1beta1.compose.docker.com: Rate Limited Requeue.
2018-05-28T19:04:17.304634900Z I0528 19:04:17.301377 1 controller.go:105] OpenAPI AggregationController: Processing item v1beta2.compose.docker.com
2018-05-28T19:04:17.311260900Z E0528 19:04:17.306398 1 controller.go:111] loading OpenAPI spec for "v1beta2.compose.docker.com" failed with: OpenAPI spec does not exists
2018-05-28T19:04:17.311302000Z I0528 19:04:17.306541 1 controller.go:119] OpenAPI AggregationController: action for item v1beta2.compose.docker.com: Rate Limited Requeue.
It doesn't seem enough to indicate high CPU usage, but the note about rate-limiting is interesting. strace on the API server also shows a continuous stream of activity, though it appears to be binary (gRPC and/or TLS-encrypted), and so I don't know what it is. I do see that the API server has 91 TCP connections open, which seems excessive.
we are aware of this issue and track it internally. The amount of CPU taken varies from system to system and is only present when Kube is enabled. With Kube enabled a couple of fairly chunky containers are running and it is yet unclear if it is these containers taking up the CPU or interactions with HyperKit
from this thread
would like some public tracking of this issue
I can confirm that this is happening for me too and most of the developers have complained about kubernetes using docker for desktop on their macs causes their computers to get very loud. It happens most frequently when deploying and then begins to quiet down, but it's been over 10 minutes since I used the kubernetes api server, all of the deployed stuff is running without any restarts, and I'm still getting a large amount of cpu used. I get these log lines once a minute from the api server:
I0712 14:28:57.714579 1 controller.go:105] OpenAPI AggregationController: Processing item v1beta1.compose.docker.com
E0712 14:28:57.721750 1 controller.go:111] loading OpenAPI spec for "v1beta1.compose.docker.com" failed with: OpenAPI spec does not exists
I0712 14:28:57.721794 1 controller.go:119] OpenAPI AggregationController: action for item v1beta1.compose.docker.com: Rate Limited Requeue.
I0712 14:28:58.679366 1 controller.go:105] OpenAPI AggregationController: Processing item v1beta2.compose.docker.com
E0712 14:28:58.683655 1 controller.go:111] loading OpenAPI spec for "v1beta2.compose.docker.com" failed with: OpenAPI spec does not exists
I0712 14:28:58.683702 1 controller.go:119] OpenAPI AggregationController: action for item v1beta2.compose.docker.com: Rate Limited Requeue.
Same happens to me and pretty much everyone I know who's using Docker for Mac. Strangely it seems to happen mostly when no container is running.
htop in privileged container when Kubernetes is enabled:

disabled:

Any movement on this issue? A fresh install of Docker for Mac on a fresh install of OSX this morning sees CPU usage hovering at 35-50% and Activity Monitor's "Energy Impact" rating for Docker sitting around ~70, which is absurdly high.
Is there anything we users can do to help push this one forward? More data collection maybe, collecting logs or providing profiling output? If there's already a fix that needs tested, is there a way for us to chip in and verify it's working with our setups?
On Mojave (18A377a), I am seeing large amounts of CPU usage (and fan spin) from hyperkit on a fresh install of both Docker stable and experimental (18.06.0-ce-mac69 26398). I did nothing outside of a fresh install, and have not enabled Kubernetes.
Also experiencing this issue making it annoying to do any sort of Kubernetes work on my Macbook Pro. Battery runtime is cut approximately in half from ~4 hours to 2 hours with Kubernetes running in Docker for Mac.
10.13.6 15" MBP mid 2015
I do hope this is going to be addressed in the near future, even if it requires an upstream patch to one of the k8s components. I see the CPU usage is primarily the kube-controller-manager which spins at about 10% of a core, followed by kube-apiserver at about 7% of a core. etcd and kube-scheduler take another 3% each or so.
HyperKit itself is spinning at 50-60%, so I don't know where the other compute is coming from but it definitely settles down after Kubernetes is disabled.
OSX 10.13.6 Docker 18.09.0-ce-beta1
With a bare kube install, I see ~50% CPU utilization from HyperKit. Inside Hyperkit, the utilization doesn't look that high, but etcd is doing something odd.

When I shut down Kube, everything goes back to normal.

I'm running Mojave and Docker Version 18.06.1-ce-mac73 (26764)
The same issue reproduces on my mac: Mojave docker-machine version 0.15.0, build b48dc28 hyperkit: 0.20180403 Docker: not installed
Same here: Mojave docker-for-mac: 2.0.0.0-beta1-mac75 (27117) Engine: 18.09.0-ce-beta1 Kubernetes: v1.10.3
Any hope of this getting fixed any time soon?
Same here. Mojave Engine/Client: 18.06.1-ce-mac73 (26764)
im on high sierra
some update somewhere is causing this issue.
please give love to docker for mac, will give love back
Same issue: osx: High Sierra docker-for-mac: 2.0.0.0-beta1-mac75 (27117) kubernetes: v1.10.3
Looks to me like there is some hypervisor related issue - load inside the VM is minimal (according to htop), but from the host (osx) it's eating basically as much CPU as I give it (more cores === more load)
Running dtruss on the hyperkit process shows that it's making and failing a ton of psynch_cvwaits:
psynch_cvsignal(0x1048AF180, 0x552FC100552FC200, 0x552FC100) = 257 0
psynch_cvwait(0x1048AF180, 0x552FC101552FC200, 0x552FC100) = 0 0
psynch_mutexdrop(0x1048AF130, 0xD7D6EF03, 0xD7D6EE00) = 0 0
psynch_mutexwait(0x1048AF130, 0xD7D6EF03, 0xD7D6ED00) = -673779965 0
psynch_cvwait(0x1048AF180, 0x552FC201552FC300, 0x552FC200) = -1 Err#316
psynch_cvwait(0x1048AF180, 0x552FC301552FC400, 0x552FC200) = -1 Err#316
psynch_cvsignal(0x7FA570050410, 0x16B0D40016B0D500, 0x16B0D400) = 257 0
psynch_cvwait(0x7FA570050410, 0x16B0D40116B0D500, 0x16B0D400) = 0 0
psynch_cvsignal(0x1048AF180, 0x552FC400552FC500, 0x552FC200) = 257 0
psynch_cvwait(0x1048AF180, 0x552FC401552FC500, 0x552FC200) = 0 0
psynch_cvwait(0x1048AF180, 0x552FC501552FC600, 0x552FC500) = -1 Err#316
will continue looking into this and will post updates here. FWIW this issue appears to occur with no pods, no deployments (totally stock kubernetes after enabling in Docker). If it helps anyone's investigation, this also occurs with Kubernetes 1.10 on Minikube via Virtualbox (so my guess is that's not related to hyperkit per say, but rather kubernetes 1.10)