-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
VM has 50% resting CPU usage when idle #3207
Comments
The same issue on Linuix. Environment: Ubuntu 18.04 Minikube version (use minikube version):
What happened: This is the consumption on 6700HQ CPU with brand new installation with out any pods. With KVM2 driver I get the same result. |
Same for me on Gentoo Linux. I have tried kvm2 and virtualbox driver but they both have an idle CPU load of ~50%. I had the same behavior with minikube 0.28.{0,2}. |
Guess it needs to be profiled... Which Kubernetes version are you using ? |
@afbjorklund Yeah, I'm running the default version. |
DevOps guy here - this is preventing some of our devs from working locally. I am running Arch personally (minikube v0.29) and get 10-30% spikes with my full application running which seems acceptable, but others (Ubuntu 18, minikube v0.30) are getting near-constant 40% usage with no pods live on both the kvm2 and virtualbox driver. |
@ianseyer are you using |
I am using |
I was playing around found that docker alone creates a ~30% load on my host system. What I did was stop the |
@corneliusweig I'm not sure about your system, but I just checked on my machine and I don't think that's what's going on. The resting docker CPU load is around ~6%. macOS 10.14 I ran |
Minikube version (use minikube version): v0.30.0 OS: (e.g. from /etc/os-release): MacOS 10.14 Very interesting notice, If you run minikube with default CPU setup (which for me is 2 CPU), you will get total consumption in IDLE ~30%, but if you change settings to 6 CPU, the you will get average consumption for ~70%. And if you use 1 CPU core it will be the ~25% in IDLE. Less cores -> less consumption. Paradox :) And all this checks was done with no pods setup. |
I set up kubernetes inside an LXC container. That way I have some isolation and no cost for the virtualization. It's not as easy to set up as minikube, but if somebody wants to try it out, I have published my notes here https://github.com/corneliusweig/kubernetes-lxd. |
Same here on Linux, with spikes that reach 90% usage. Tried with
|
I also experience high cpu usage on my MacBook Pro (macOS Mojave 10.14.2). It also causes high CPU temperature which makes my fans run at full speed, including the annoying noise. Minikube v0.30.0 |
Around 30% of constant cpu usage here on my Macbook (i7 2.7 Ghz) after a clean setup.
|
I'm seeing around 30-50% CPU from the relevant Note: I ask this as a question as I can't see any familiar linux package managers inside the VM and it's missing basic tools (bzip2, tar) to even start the installation. |
Still not fixed ? I thought Kubernetes was mainstream 😏 |
Same here with minikube Kind of a showstopper for pushing my colleague's workflows into the direction of local Kubernetes... |
@wojciechka this is interesting, what was your idle cpu usage before and after this change and the specs of your machine? |
Just tried this on Fedora 31, but haven't done a scientific test. I think I can see the surges every 5-sec without the @wojciechka tweak, and see them go away (or diminish) after making the tweak. I still think that minikube is using more cpu than microk8s. Minikube (over microk8s) gives the easy ability to have multiple clusters that can be started / stopped with states saved via profiles. |
I actually found my problem - it was swapping. The default of 2GB memory with no minikube options tuned was not enough for anything to happen, even creating a namespace, without swapping. |
@wojciechka thanks for sharing this valuable workaround with us! |
Here is some additional information on this. Regarding where I am running this - I am running minikube on Linux. The host machine is a sLinux Debian 9 Stretch, with i3-2100 CPU (2 cores, 2 threads at 3.1 GHz). The machine has 32GB of RAM. The host machine runs some background tasks, but it is not under anything close to a heavy load - the load is below 0.5 when I do not have minikube started. For testing I do not run any workloads on minikube. Minikube has 4 CPUs and 16GB of RAM assigned to it. I also do not run any workloads in minikube when I do tests. When the Output from top via
When I change the setting to use the current minikube default of 5 seconds for Here's output from top in
While top does not report significant usage by any process, it seems higher. I also see the I have also tried to set the The interval of 5 seconds was added by the following commit: Update addon-manager to v9.0.2, disable master negotiation and increase reconcile frequency Perhaps it would be a good idea to revert the change to 5 seconds, or at least change it to a slightly longer interval like 30 seconds? This was added 2 months ago, so I suspect my reporting of the problem does not overlap with the original issues from October 2018. I am not sure if this should be tracked under same issue or separate issue. |
Did what @wojciechka proposed together with mem increase to 4 Gb from default 2 Gb (as suggested by @jroper). It drops CPU usage of my laptop (2c/4t) from 70-80% to 40-50% but it is does not solve a problem. CPU is still boosted from idle clocks and fan is working on high revs. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Since issue is marked as stale my solution was is to end up with microk8s in VBox. Works like a charm, no abnormal CPU consumption. |
I went with KinD (kubernetes in docker). Highly recommended as it works well on linux and macos (haven't tested windows, although it is supported). Bonus is you can use it for CI/CD as well. |
Similar story here, I went with microk8s or docker-for-mac, they don't have the high resting CPU usage. |
/lifecycle frozen |
FWIW, recent versions of minikube are much better. Idle CPU on my mac with Hyperkit is about 1/3 of a CPU (33%). |
33% is still bad. I am having a constant 30% with the latest version of minikube on vmware. It was 50% with virtualbox. |
It appears most of the CPU usage is Note: Kubelet doesn't allow adjusting its housekeeping period (which I suspect is an intensive task). See kubernetes/kubernetes#89936 What I ChangedI'm posting this in the interest of sharing my experience but I ultimately gave up on using minikube. The CPU usage from Kubernetes on a macOS laptop is just too high to roll out to a team (even trying to ignore how wasteful xhyve is). Your success may vary and any improvements will disappear after restarting minikube. These changes could potentially be applied with Relevant Files/etc/kubernetes/manifests/kube-apiserver.yaml Controller ChangesDisabling Leader Elections (~5% CPU)Minikube is ran in a single instance that should not have multiple controller-managers or schedulers.
Disabling Watch Cache (~5% CPU)We are likely not running a significant amount of watches and I suspect this is an expensive operation.
Small kubelet Tweak (~2% CPU)Kubelet has a few operations that it needs to do routinely to stay healthy as a node. Add to kube-controller-manager.yaml: Adjust these in the kubelet config.yaml and then restart kubelet with
Small Controller Manager Syncs Tweak (~2% CPU)Add to kube-controller-manager.yaml:
|
Hey everyone! We've made some overhead improvements in the past few months:
On my machine, with the hyperkit driver, resting CPU of an idle cluster has reduced by 52% to on average 18% of a core. I'm going to close this issue since I think it's been addressed, but if anyone is still seeing high CPU usage with the latest minikube version, please comment and reopen this issue by including /reopen in your comment. Thank you! |
Is upgrading to minikube version |
Same here. How to make use of this fix? |
@priyawadhwa Thanks, updated but still having performance issue. Opened a new issue #9104 which got closed right after. seems like there is no solution anymore. |
@mitchej123 I tested docker-for-mac, minikube, microk8s, k3d and they all have the same issue. Some of them run as root and you need to use |
Was the issue actually resolved? Reports from various github sections including Docker for Mac and kubernetes itself is pointing to behavior of high polling into etcd as a root cause. The adjustments mentioned by priyawadhwa when closing the issue seem to be addressing what could be done in minikube. But core k8s issues seem to remain and are seen in various configurations/deployments. kubernetes/kubernetes#75565 |
@talj-us-ibm-com At this point, I think the work referenced by @priyawadhwa does address most of the overhead that minikube can control (other adjustments that I brought up could cause things to be inconsistent longer). I had mentioned previously that a big portion of the overhead is kubernetes/kubernetes#75565. (I had opened kubernetes/kubernetes#89936 as a feature path towards addressing this in minikube.) At the risk of being a bit ranty (and in reference to docker/for-mac#3065), all of that is on top of Docker for Mac having disk performance issues (the recent gRPC FUSE changes help some), virtualization cpu performance issues, and a whole set of hoops that Docker has to jump through to make docker even run on a Mac. |
Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT
Please provide the following details:
Environment: macOS 10.13.6
Minikube version (use
minikube version
): v0.29.0cat ~/.minikube/machines/minikube/config.json | grep DriverName
): hyperkitcat ~/.minikube/machines/minikube/config.json | grep -i ISO
orminikube ssh cat /etc/VERSION
): v0.29.0What happened:
I just installed and set up a fresh minikube cluster. CPU usage is pegged at ~50% even though no pods have been launched and nothing is happening on the cluster. I've observed the same behavior across both hyperkit and VirtualBox.
I ran
minikube addons enable heapster
to get some insight into where all the CPU is going. It looks like kube-apiserver-minikube and kube-controller-manager-minikube are the primary offenders.What you expected to happen:
I expected the CPU usage to fall to basically zero when at rest. I understand that this may just be the baseline CPU usage for some of these services (liveness checks, etc). But when running in minikube mode, it'd really be nice to slow down the CPU consumption so that we don't kill all of our laptop batteries.
How to reproduce it (as minimally and precisely as possible):
Create a minikube cluster on macOS with the appropriate versions.
Output of
minikube logs
(if applicable): n/aAnything else do we need to know: n/a
The text was updated successfully, but these errors were encountered: