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

issue: high cpu usage #844

Merged
merged 1 commit into from
Aug 18, 2015
Merged

issue: high cpu usage #844

merged 1 commit into from
Aug 18, 2015

Conversation

jhjeong-kr
Copy link
Contributor

housekeeping function is invoked 1sec(default) even if system time changed greatly.
let's suppose that cadvisor is running on a vm and the vm is about to be suspended for 1 day,
and, after 1 day, vm is resumed.
At the moment, cadvisor runs at full speed, because nexthousekeeping is current housekeeping + 1sec.
Therefore, cadvisor collects stats 1day * 24hours * 60minutes * 60seconds times without sleep.
In my systems, cadvisor occupies 100% cpu time almost for 3 hours.
soluton:
If cadvisor notices time change(allowedHouseKeepingGap or higher), cadvisor has to adjust nexthousekeeping.
I implemented this patch with allowedHouseKeepingGap constant.

Signed-off-by: Jin-Hwan Jeong jhjeong.kr@gmail.com

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@cadvisorJenkinsBot
Copy link
Collaborator

Can one of the admins verify this patch?

@jhjeong-kr
Copy link
Contributor Author

I signed it!

2015년 8월 7일 (금) 오후 3:41, cadvisorJenkinsBot notifications@github.com님이 작성:

Can one of the admins verify this patch?


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

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

@vmarmol
Copy link
Contributor

vmarmol commented Aug 7, 2015

ok to test

@@ -63,6 +63,7 @@ type containerData struct {
loadAvg float64 // smoothed load average seen so far.
housekeepingInterval time.Duration
maxHousekeepingInterval time.Duration
allowedHouseKeepingGap time.Duration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we never set a default for this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was dropped while testing via cli argument.
At the moment, it would be better to set as a constant.
I set 1 minute as a default in housekeeping().

@vmarmol
Copy link
Contributor

vmarmol commented Aug 7, 2015

Actually, what if in housekeeping we just set next to now when next is not "before" now? Should keep this from happening without needed a configurable jump.

Nice find btw :)

@jhjeong-kr
Copy link
Contributor Author

@vmarmol Yes, Your suggestion is the simplest way to stop the issue, but I want to distinguish between two cases, 1) system time change(by suspend/resume), 2) actually host machine is very busy(really really busy), so I tried to fix nexthousekeeping() function.
If you want, I can update PR.

@jhjeong-kr jhjeong-kr force-pushed the master branch 2 times, most recently from db86ff8 to bcfeff4 Compare August 10, 2015 05:45
@vmarmol
Copy link
Contributor

vmarmol commented Aug 17, 2015

Hey @jhjeong-kr I would prefer we make the change. I'm not sure we need to distinguish between the cases unless you strongly disagree.

@jhjeong-kr
Copy link
Contributor Author

@vmarmol OK. May I update the source as you recommend? If you prefer a simpler way, I can update this PR within a couple of hours.

@vmarmol
Copy link
Contributor

vmarmol commented Aug 17, 2015

Updating the source SGTM.

…ng()" problem if system time has changed

Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
@jhjeong-kr
Copy link
Contributor Author

I updated the source code.

@vmarmol
Copy link
Contributor

vmarmol commented Aug 18, 2015

LGTM, thanks @jhjeong-kr!

vmarmol added a commit that referenced this pull request Aug 18, 2015
@vmarmol vmarmol merged commit f6d53e4 into google:master Aug 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants