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

Add occupy mechanism for future buckets of sliding window to support "prioritized requests" #568

Merged
merged 7 commits into from
Mar 14, 2019

Conversation

sczyh30
Copy link
Member

@sczyh30 sczyh30 commented Mar 13, 2019

Describe what this PR does / why we need it

Add occupy mechanism for future buckets of sliding window to support "prioritized requests".

Does this pull request fix one issue?

Related to #207

Describe how you did it

image

  • Rename: MetricsLeapArray -> BucketLeapArray
  • Add implementation for FutureBucketLeapArray, a kind of BucketLeapArray that only reserves for future buckets, which is used for calculating occupied future tokens.
  • Add OccupiableBucketLeapArray that combines common BucketLeapArray with FutureBucketLeapArray. The rollingNumberInSecond in StatisticNode now uses OccupiableBucketLeapArray by default.
  • Add OccupySupport interface. Node now implements OccupySupport interface.
  • Add occupy-related methods in Metric and ArrayMetric.
  • Handle prioritized requests in default traffic shaping controller.

Describe how to verify it

Run the test case and demo.

Special notes for reviews

This PR contains breaking changes, please consider it carefully.

- Update test cases
- Also add `totalPass` method in Node interface

Signed-off-by: Eric Zhao <[email protected]>
- Also fix for test cases

Signed-off-by: Eric Zhao <[email protected]>
Signed-off-by: Eric Zhao <[email protected]>
@sczyh30 sczyh30 added the to-review To review label Mar 13, 2019
@sczyh30 sczyh30 added this to the 1.5.0 milestone Mar 13, 2019
@codecov-io
Copy link

Codecov Report

Merging #568 into master will decrease coverage by 0.1%.
The diff coverage is 41.53%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #568      +/-   ##
============================================
- Coverage     38.73%   38.63%   -0.11%     
- Complexity     1186     1213      +27     
============================================
  Files           271      275       +4     
  Lines          8488     8674     +186     
  Branches       1133     1159      +26     
============================================
+ Hits           3288     3351      +63     
- Misses         4785     4906     +121     
- Partials        415      417       +2
Impacted Files Coverage Δ Complexity Δ
.../sentinel/slots/statistic/base/UnaryLeapArray.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ow/statistic/metric/ClusterParameterLeapArray.java 0% <ø> (ø) 0 <0> (ø) ⬇️
.../slots/statistic/metric/HotParameterLeapArray.java 85.36% <ø> (ø) 12 <0> (ø) ⬇️
.../flow/statistic/metric/ClusterMetricLeapArray.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ntinel/slots/statistic/metric/BucketLeapArray.java 100% <ø> (ø) 3 <0> (?)
.../csp/sentinel/slots/statistic/base/WindowWrap.java 71.42% <0%> (-5.5%) 6 <1> (+1)
...va/com/alibaba/csp/sentinel/node/EntranceNode.java 4.08% <0%> (-0.47%) 1 <0> (ø)
...ba/csp/sentinel/slots/statistic/StatisticSlot.java 52.38% <0%> (-8.74%) 10 <0> (ø)
...ntinel/slots/block/flow/PriorityWaitException.java 0% <0%> (ø) 0 <0> (?)
...ibaba/csp/sentinel/node/OccupyTimeoutProperty.java 0% <0%> (ø) 0 <0> (?)
... and 24 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 860e7eb...901bfae. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Mar 13, 2019

Codecov Report

Merging #568 into master will increase coverage by 0.03%.
The diff coverage is 40.27%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #568      +/-   ##
============================================
+ Coverage     39.09%   39.12%   +0.03%     
- Complexity     1196     1225      +29     
============================================
  Files           271      275       +4     
  Lines          8494     8674     +180     
  Branches       1134     1159      +25     
============================================
+ Hits           3321     3394      +73     
- Misses         4754     4853      +99     
- Partials        419      427       +8
Impacted Files Coverage Δ Complexity Δ
.../sentinel/slots/statistic/base/UnaryLeapArray.java 0% <ø> (ø) 0 <0> (ø) ⬇️
.../flow/statistic/metric/ClusterMetricLeapArray.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ntinel/slots/statistic/metric/BucketLeapArray.java 100% <ø> (ø) 3 <0> (?)
.../slots/statistic/metric/HotParameterLeapArray.java 85.36% <ø> (ø) 12 <0> (ø) ⬇️
...ow/statistic/metric/ClusterParameterLeapArray.java 0% <ø> (ø) 0 <0> (ø) ⬇️
...ba/csp/sentinel/slots/statistic/StatisticSlot.java 52.38% <0%> (-8.74%) 10 <0> (ø)
...ntinel/slots/block/flow/PriorityWaitException.java 0% <0%> (ø) 0 <0> (?)
.../csp/sentinel/slots/statistic/base/WindowWrap.java 71.42% <0%> (-5.5%) 6 <1> (+1)
...ibaba/csp/sentinel/node/OccupyTimeoutProperty.java 0% <0%> (ø) 0 <0> (?)
...csp/sentinel/slots/block/flow/FlowRuleChecker.java 45.45% <100%> (ø) 16 <0> (ø) ⬇️
... and 19 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 4b1ccd9...bc6962d. Read the comment docs.

Copy link
Contributor

@CarpenterLee CarpenterLee left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants