Skip to content

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

Merged
sczyh30 merged 7 commits into
masterfrom
feature/occupy-local
Mar 14, 2019
Merged

Add occupy mechanism for future buckets of sliding window to support "prioritized requests"#568
sczyh30 merged 7 commits into
masterfrom
feature/occupy-local

Conversation

@sczyh30

@sczyh30 sczyh30 commented Mar 13, 2019

Copy link
Copy Markdown
Member

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.

sczyh30 added 3 commits March 11, 2019 20:32
- Update test cases
- Also add `totalPass` method in Node interface

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
- Also fix for test cases

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@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
@sczyh30
sczyh30 requested a review from CarpenterLee March 13, 2019 02:09
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
@codecov-io

Copy link
Copy Markdown

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

codecov-io commented Mar 13, 2019

Copy link
Copy Markdown

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.

@CarpenterLee CarpenterLee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Eric Zhao <sczyh16@gmail.com>
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