-
Notifications
You must be signed in to change notification settings - Fork 438
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
[177] Add "warm-up" control behavior support #190
Conversation
Could you please also provide some unit tests (not just the example)? |
Later I will try to add UT. |
Codecov Report
@@ Coverage Diff @@
## master #190 +/- ##
==========================================
- Coverage 43.99% 43.44% -0.55%
==========================================
Files 80 81 +1
Lines 4453 4507 +54
==========================================
- Hits 1959 1958 -1
- Misses 2264 2319 +55
Partials 230 230
Continue to review full report at Codecov.
|
Large amount of error occurred when I was running the warm-up example (printed in sentinel-record.log):
|
# Conflicts: # core/flow/rule.go
@@ -101,6 +101,10 @@ func (m *SlidingWindowMetric) GetQPS(event base.MetricEvent) float64 { | |||
return m.getQPSWithTime(util.CurrentTimeMillis(), event) | |||
} | |||
|
|||
func (m *SlidingWindowMetric) GetPreviousQPS(event base.MetricEvent) float64 { | |||
return m.getQPSWithTime(util.CurrentTimeMillis()-uint64(m.bucketLengthInMs), event) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial design of the method is for getting the metric of last second (i.e. elapsed, "stable" second). Here we got the latest 1 sec (with current bucket, i.e. unstable bucket). We may discuss it later.
} | ||
|
||
func NewWarmUpTrafficShapingCalculator(rule *FlowRule) *WarmUpTrafficShapingCalculator { | ||
if rule.WarmUpColdFactor == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bad coldFactor value (<=0) should be filtered out when validating rules in flow rule manager (though checking is also needed here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. We may improve the implementation later.
Nice work. Thanks for contributing! |
Describe what this PR does / why we need it
Add "warm-up" control behavior support
Does this pull request fix one issue?
#177
Describe how you did it
Describe how to verify it
run qps_warm_up_example.go
Special notes for reviews