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

Idle cluster, CPU usage increasing #10659

Closed
lavalamp opened this issue Jul 2, 2015 · 46 comments
Closed

Idle cluster, CPU usage increasing #10659

lavalamp opened this issue Jul 2, 2015 · 46 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/node Categorizes an issue or PR as relevant to SIG Node.

Comments

@lavalamp
Copy link
Member

lavalamp commented Jul 2, 2015

Over the course of ~ 18 hours, my idle cluster's CPU usage went from ~5% -> ~20%. I repeated it with another cluster, which seems to have a single node with increasing CPU usage.

Surprisingly, kubelet seems to be the hog. I used pprof to figure it out. It turns out to be the exec based liveness probe that the kube-dns pod uses. Turning that off makes kubelet stop using so much CPU. The before & after pprof chart was very clear.

I don't have an answer for why the usage grows over time; maybe docker keeps some history such that every exec returns a bit more data than the previous one?

@lavalamp lavalamp added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/node Categorizes an issue or PR as relevant to SIG Node. labels Jul 2, 2015
@lavalamp
Copy link
Member Author

lavalamp commented Jul 2, 2015

@dchen1107 for node problem

@thockin can we replace the exec liveness probe with something?

@lavalamp lavalamp added this to the v1.0-candidate milestone Jul 2, 2015
@bprashanth
Copy link
Contributor

I made a mental note to myself that if anything was using exec on the node we might run into weirdness because of a potential timer leak but I dismissed it at the time. Does your pprof have a bloated siftdown timer block by any chance?

@bprashanth
Copy link
Contributor

Hmm, I take that back, the timeout is too small really. But can you post the pprof?

@lavalamp
Copy link
Member Author

lavalamp commented Jul 2, 2015

Sorry, I didn't actually save the pprof from the broken state. But it's easy to reproduce. It did have a small timer section, but the vast majority of the time went to json decoding docker output (and the associated garbage cleanup).

@bprashanth
Copy link
Contributor

then ignore my eagerness to correlate to other cpu issues I've seen

@derekwaynecarr
Copy link
Member

So is this an issue with any exec liveness probe or just this probe?

On Wednesday, July 1, 2015, Prashanth B notifications@github.com wrote:

then ignore my eagerness to correlate to other cpu issues I've seen


Reply to this email directly or view it on GitHub
#10659 (comment)
.

@lavalamp
Copy link
Member Author

lavalamp commented Jul 2, 2015

@bprashanth You're not wrong, that's clearly a bug, just not this bug :)

@derekwaynecarr I think it's probably all exec probes, barring further evidence.

Further detail: after turning off the exec probe, my cluster's CPU stopped growing but did not go down.

@dchen1107
Copy link
Member

Will look into it tomorrow.

@dchen1107 dchen1107 added the kind/bug Categorizes issue or PR as related to a bug. label Jul 2, 2015
@dchen1107 dchen1107 modified the milestones: v1.0, v1.0-candidate Jul 2, 2015
@thockin
Copy link
Member

thockin commented Jul 2, 2015

Without that probe we have no real way to know when DNS is in trouble.

On Wed, Jul 1, 2015 at 10:28 PM, Dawn Chen notifications@github.com wrote:

Will look into it tomorrow.


Reply to this email directly or view it on GitHub
#10659 (comment)
.

@lavalamp
Copy link
Member Author

lavalamp commented Jul 4, 2015

Further followup: I rebooted the offending kubelet and the CPU dropped back to its initial level. Rebooting a different kubelet didn't have any effect. So it seems clear that exec leaks something.

@dchen1107
Copy link
Member

I did measurement over the long weekend through heapster, and couldn't reproduce the issue. I did observe slight cpu usage increase by running docker exec, but not as obvious as what reported here. Chatted with @lavalamp offline, he observed such increase from GCE pantheon ui, which is known NOT-ACCURATE since it includes all overheads for running VM itself.

@lavalamp
Copy link
Member Author

lavalamp commented Jul 6, 2015

I can readily believe it's not accurate (it doesn't agree with top, for example), but since restarting kubelet made the numbers go back down, I don't believe the VM overhead is a contributing factor.

@dchen1107
Copy link
Member

I sync-ed my client to HEAD, which includes ##10763, then I brought up a cluster after lunch, and monitored kubelet usage through heapster, and couldn't reproduce the issue. I will leave the cluster for one night, and recheck it.

@lavalamp
Copy link
Member Author

lavalamp commented Jul 7, 2015

I started a cluster from head just now, too. We'll see if I repro. :)

On Mon, Jul 6, 2015 at 5:38 PM, Dawn Chen notifications@github.com wrote:

I sync-ed my client to HEAD, which includes ##10763
#10763, then I
brought up a cluster after lunch, and monitored kubelet usage through
heapster, and couldn't reproduce the issue. I will leave the cluster for
one night, and recheck it.


Reply to this email directly or view it on GitHub
#10659 (comment)
.

@dchen1107
Copy link
Member

I leave my cluster run over-night. node af12 has kubernetes dns pod running and invoke docker exec every 10s. The below is kubelet cpu usage on node af12 over last 18 hours:

kubelet_cpuusage_af12

There is slight cpu usage increase, but overall usage is ~2%. Based on this graph, it is not worthy doing anything for 1.0.

We are going to continue monitoring this for more soaking time.

@dchen1107 dchen1107 self-assigned this Jul 7, 2015
@alex-mohr alex-mohr added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Jul 7, 2015
@lavalamp
Copy link
Member Author

lavalamp commented Jul 7, 2015

I can no longer reproduce this, either. Will assume that #10763 fixed the vast majority of the problem. Thanks, Prashanth!

@lavalamp lavalamp closed this as completed Jul 7, 2015
@alex-mohr
Copy link
Contributor

Triaged to P0 in war room -- continually increasing CPU usage breaks clusters, so until we're sure it's fixed (and not just likely fixed), leaving open as P0.

FWIW, the CPU reporting is in some sense the most accurate with that caveat that it includes all of the VM's usage -- user level, system level, kernel level, and yes, hypervisor overheads -- and is reflective of what the user sees as available for their own use. Even if the cpu usage is coming from a different source than kubelet, kubernetes isn't usable if $unknown_source climbs to 50+% usage.

@alex-mohr alex-mohr reopened this Jul 7, 2015
@alex-mohr
Copy link
Contributor

Also, @dchen1107 or @lavalamp -- seems like there's a test or release coverage gap here? Presumably this isn't something that'd make it out to an official borg or omega release. Do either of you have enough context to file an issue and/or propose something that would catch these next time?

@brendandburns
Copy link
Contributor

we could also use a TCP socket health check on port 53 as a poor man's health check.

@thockin
Copy link
Member

thockin commented Jul 7, 2015

This would be only marginally better than no liveness probe - I am not so
much worried about the server not listening as I am about it not producing
results.

On Tue, Jul 7, 2015 at 4:11 PM, Brendan Burns notifications@github.com
wrote:

we could also use a TCP socket health check on port 53 as a poor man's
health check.


Reply to this email directly or view it on GitHub
#10659 (comment)
.

@brendandburns
Copy link
Contributor

yeah, though is bouncing the container really going to help it produce results?

@thockin
Copy link
Member

thockin commented Jul 7, 2015

maybe. It helped in the past when skydns could not talk to etcd because it
raced at startup. I really want multi-container or whole-pod bounces, but
that is a larger feature (already filed)

On Tue, Jul 7, 2015 at 4:21 PM, Brendan Burns notifications@github.com
wrote:

yeah, though is bouncing the container really going to help it produce
results?


Reply to this email directly or view it on GitHub
#10659 (comment)
.

dchen1107 added a commit to dchen1107/kubernetes-1 that referenced this issue Jul 7, 2015
@dchen1107
Copy link
Member

@alex-mohr on why not switch back to nsinit: Kubelet still has that support if docker exec is not available. We could fall back to nsinit. But containervm image removed nsinit recently after we switched to docker native exec. Also this introduces another dependency on our node too.

yujuhong added a commit that referenced this issue Jul 8, 2015
Disable liveness for dns due to #10659
@goltermann goltermann added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. labels Jul 8, 2015
@goltermann goltermann modified the milestones: v1.0-post, v1.0 Jul 8, 2015
@goltermann
Copy link
Contributor

Moving from P0 to P1 and to v1.0-post milestone. A workaround is in, and that's enough for v1.

@dchen1107
Copy link
Member

#10760 for release document

@philk
Copy link

philk commented Jul 8, 2015

moby/moby#12899 is probably relevant to this issue. We ran into a number of weird issues (cpu, memory, stalls, failure to exec) when using docker exec for a periodic health check (not even using k8s).

@piosz
Copy link
Member

piosz commented Jul 9, 2015

This may be also caused by Heapster itself kubernetes-retired/heapster#397

@timothysc
Copy link
Member

/cc @jayunit100 @rrati.

@dchen1107
Copy link
Member

@piosz that explains Heapster's memory leakage issue I observed when working on
#10653 (comment)

@bprashanth
Copy link
Contributor

Heapster wasn't on my node and that doesn't correlate with the exec probe restart causing cpu to fall. Of course, heapster has issues of its own :)

@lavalamp
Copy link
Member Author

lavalamp commented Jul 9, 2015

Heapster may have its own problems, but it wasn't the cause of my initial
report.

On Thu, Jul 9, 2015 at 1:55 PM, Prashanth B notifications@github.com
wrote:

Heapster wasn't on my node and that doesn't correlate with the exec probe
restart causing cpu to fall. Of course, heapster has issues of its own :)


Reply to this email directly or view it on GitHub
#10659 (comment)
.

@bgrant0607 bgrant0607 removed this from the v1.0-post milestone Jul 24, 2015
@yujuhong
Copy link
Contributor

The docker exec issue (moby/moby#14444) was closed long agao and we already have resource usage test running repeatedly int he soak cluster. Closing this ancient issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/node Categorizes an issue or PR as relevant to SIG Node.
Projects
None yet
Development

No branches or pull requests