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

cpu_usage_limit not working as expected #3583

Open
Seven-709 opened this issue Apr 9, 2020 · 16 comments
Open

cpu_usage_limit not working as expected #3583

Seven-709 opened this issue Apr 9, 2020 · 16 comments
Labels
C: Client P: Minor T: Informational Information only, no code changes required

Comments

@Seven-709
Copy link

Hi all,

I'm running BOINC (SETI and WCG) on my MBP Mid-2105 since quite some time (several years) now. However, one behavior of the client is confusing me almost the whole time. When limiting the percentage of CPU Time the actual average CPU load caused by BOINC might be totally different ... examples: At 1% the actual load is ~70%, at 12,5% it's ~12%, at 30% it's ~9% and at 50% it's ~50% (all loads are 10 minute averages). My expectation is that when I configure a certain max CPU load percentage then BOINC is indeed only using that load, give or take 5% ... But in fact it seems that only certain values are producing a "correct" load, whereas all other values in between have a more or less random effect on the actual load.

Of course, it's always possible that either my expectation is wrong or I did something wrong in the configuration. In any other case, I'm more than happy to provide further information to get this issue solved.

regards
Seven

@AenBleidd
Copy link
Member

I'm afraid, your calculations are a little bit wrong. Limiting CPU time means limiting a time when application actually run.
E.g. we have 1 second.
So if we set CPU usage to 50%, BOINC will run 0,5 seconds at 100% of CPU giving in total 50% of CPU usage.
If you set CPU usage to 30%, BOINC will run 0.3 seconds at 100% giving in total 30% of CPU usage.
But!
There is no way to tell OS to run some thread some particular amount of time, for example 0.5 seconds. Because of the scheduling policy, thread could run less that 0.5 seconds because there was more prioritized thread in the system, or it could run a little bit more than 0.5 seconds, because OS missed the exact moment to put the thread on sleep mode.
And even more: there is no clear way to see exact CPU usage of some particular process, at least with standard tools of OS.

I hope I answered your question.

@Seven-709
Copy link
Author

Seven-709 commented Apr 9, 2020 via email

@SETIguy
Copy link
Contributor

SETIguy commented Apr 9, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 10, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 10, 2020 via email

@davidpanderson
Copy link
Contributor

BTW: CPU throttling has 1-second granularity.
If you have it set to 25% it will do (1s on, 3s off)*

I'll test this on my Mac.

@SETIguy
Copy link
Contributor

SETIguy commented Apr 10, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 11, 2020 via email

@Ageless93
Copy link
Contributor

Ageless93 commented Apr 11, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 11, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 11, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 11, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 26, 2020 via email

@davidpanderson
Copy link
Contributor

davidpanderson commented Apr 29, 2020 via email

@Seven-709
Copy link
Author

Seven-709 commented Apr 29, 2020 via email

@AenBleidd AenBleidd added C: Client P: Minor T: Informational Information only, no code changes required labels Sep 25, 2020
@sirzooro
Copy link
Contributor

sirzooro commented Nov 3, 2020

On Linux you can use cgroups to limit cpu usage for process. They are implemented in kernel, so it should work better than code used by BOINC now.
https://en.wikipedia.org/wiki/Cgroups

According to linked Wikipedia page Windows also has similar feature called Job Objects. Not sure if other systems have something similar. For them you could keep existing throttling code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Client P: Minor T: Informational Information only, no code changes required
Projects
Status: Backlog
Development

No branches or pull requests

6 participants