-
Notifications
You must be signed in to change notification settings - Fork 110
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
feature: Fine-grained control of the CPU. #115
Open
Super-long
wants to merge
10
commits into
chaosblade-io:master
Choose a base branch
from
Super-long:Refinement_of_CPU_control
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feature: Fine-grained control of the CPU. #115
Super-long
wants to merge
10
commits into
chaosblade-io:master
from
Super-long:Refinement_of_CPU_control
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Super-long
force-pushed
the
Refinement_of_CPU_control
branch
from
May 24, 2022 02:58
3285694
to
bb0d1ea
Compare
Signed-off-by: Super-long <[email protected]>
Signed-off-by: Super-long <[email protected]>
Super-long
force-pushed
the
Refinement_of_CPU_control
branch
2 times, most recently
from
May 24, 2022 09:00
df4bf7f
to
a3a673a
Compare
Signed-off-by: Super-long <[email protected]>
Super-long
force-pushed
the
Refinement_of_CPU_control
branch
from
May 24, 2022 12:31
a3a673a
to
910dab7
Compare
Signed-off-by: Super-long <[email protected]>
Super-long
force-pushed
the
Refinement_of_CPU_control
branch
from
May 25, 2022 02:06
f2afb5b
to
aecf663
Compare
Signed-off-by: Super-long <[email protected]>
Signed-off-by: Super-long <[email protected]>
Signed-off-by: Super-long <[email protected]>
Signed-off-by: Super-long <[email protected]>
Signed-off-by: Super-long <[email protected]>
Signed-off-by: Super-long <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Super-long [email protected]
Describe what this PR does / why we need it
This PR attempts to improve the existing CPU burn implementation by modifying the coarse-grained loop to a finer one and introducing more algorithms to enrich the CPU burn.
Describe how you did it
The existing CPU fullload maintains the CPU load specified by the cpu-percent and gets q and ds based on the quota channel, then executes the CPU burn logic based on q and ds, I modified the implementation of the existing loop to introduce a richer and more diverse cpu burn algorithm, the algorithm ideas refer to the implementation of
stress-ng --cpu-load
.Notes
The reason I greatly complicated burn's default judgment compared to previous implementations is that in extreme cases burn may get two consecutive values from quota, which can cause a sudden increase in CPU burn load. I encountered the following situation in the
910dab71b62ff91bbc715ccde4fc5faf59d274c1
commit:TODO List
New features are still being implemented, I hope you have more comments.
cpu_methods
.Specify the CPU percentage
section inhttps://blog.csdn.net/weixin_43705457/article/details/124904793
Test
taskset -c 0 . /chaos_os create cpu fullload --uid=d32d49a509d73856 --cpu-count=1 --cpu-percent=70 --cpu-index 0
Observe that the current CPU0 load is about 70%.taskset -c 0 . /stress-ng --cpu 1 --cpu-load 40 --timeout 20h
and observe that the CPU usage of the stress-ng process is 40% and the CPU usage of the chaos_os process is 30%.taskset -c 0 . /stress-ng --cpu 1 --cpu-load 80 --timeout 20h
and observe that the CPU usage of the stress-ng process is 80% and chaos_os is nearly zero.CPU burn
The current individual CPU burn algorithm's average consumption time, The test code is available here: https://github.com/Super-long/tproxy-http_hijacking/blob/main/stress_cpu.go