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

[Feature] Add CPU usage checking support in system protection rule #484

Merged
merged 2 commits into from
Mar 6, 2019

Conversation

CarpenterLee
Copy link
Contributor

@CarpenterLee CarpenterLee commented Feb 12, 2019

Describe what this PR does / why we need it

Sentinel System Guard takes average RT, QPS, thread count and system load into account, but does not consider CPU usage. Comparing to system load, CPU usage is more sensitive, which is useful when vast requests coming in sudden.

Does this pull request fix one issue?

Resolves #450

Describe how you did it

Add CPU usage threshold into system rule, and when current CPU usage reaches the threshold, a BBR likely checking will be done.

Describe how to verify it

Rule SystemGuardDemo.

Signed-off-by: Carpenter Lee <hooleeucas@163.com>
@sczyh30 sczyh30 added the to-review To review label Feb 12, 2019
@sczyh30 sczyh30 changed the title [Feature]CPU usage system guard [Feature] Add CPU usage checking support in system protection rule Feb 13, 2019
@sczyh30
Copy link
Member

sczyh30 commented Feb 13, 2019

As the OperatingSystemMXBean#getSystemCpuLoad API was introduced since JDK 1.7, the minimum JDK version of sentinel-core needs to be upgraded to 1.7 too (related to #235). This will bring breaking change so we're targeting this feature to next big milestone version (1.5.0).

@sczyh30 sczyh30 added this to the 1.5.0 milestone Feb 13, 2019
Signed-off-by: Carpenter Lee <hooleeucas@163.com>
@CarpenterLee CarpenterLee force-pushed the feature/cpu_usage_system_protection branch from 57631a2 to 20706b8 Compare March 6, 2019 12:14
@codecov-io
Copy link

codecov-io commented Mar 6, 2019

Codecov Report

Merging #484 into master will increase coverage by 0.64%.
The diff coverage is 40.47%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #484      +/-   ##
===========================================
+ Coverage     37.96%   38.6%   +0.64%     
- Complexity     1111    1160      +49     
===========================================
  Files           259     259              
  Lines          8177    8385     +208     
  Branches       1115    1176      +61     
===========================================
+ Hits           3104    3237     +133     
- Misses         4668    4737      +69     
- Partials        405     411       +6
Impacted Files Coverage Δ Complexity Δ
.../alibaba/csp/sentinel/slots/system/SystemRule.java 28.57% <25%> (-0.7%) 8 <1> (+1)
...a/csp/sentinel/slots/system/SystemRuleManager.java 43.79% <39.28%> (-1.82%) 8 <0> (ø)
...sp/sentinel/slots/system/SystemStatusListener.java 48.14% <66.66%> (+0.32%) 4 <0> (ø) ⬇️
.../sentinel/slots/statistic/data/ParamMapBucket.java 80.76% <0%> (-2.57%) 10% <0%> (ø)
.../src/main/java/com/alibaba/csp/sentinel/CtSph.java 73.84% <0%> (-0.39%) 40% <0%> (+16%)
.../handler/FetchClusterServerInfoCommandHandler.java 0% <0%> (ø) 0% <0%> (ø) ⬇️
...sentinel/cluster/flow/ClusterParamFlowChecker.java 0% <0%> (ø) 0% <0%> (ø) ⬇️
...tinel/slots/block/flow/param/ParamFlowChecker.java 47.41% <0%> (+0.42%) 29% <0%> (+9%) ⬆️
...slots/block/flow/controller/DefaultController.java 62.96% <0%> (+0.46%) 12% <0%> (+6%) ⬆️
...sentinel/eagleeye/EagleEyeRollingFileAppender.java 31.21% <0%> (+2.31%) 12% <0%> (+1%) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33fc154...20706b8. Read the comment docs.

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

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

LGTM

@sczyh30 sczyh30 merged commit 5279895 into master Mar 6, 2019
@sczyh30 sczyh30 removed the to-review To review label Mar 6, 2019
@sczyh30
Copy link
Member

sczyh30 commented Mar 6, 2019

Thanks!

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.

Add CPU utilization in system rule
3 participants