-
Notifications
You must be signed in to change notification settings - Fork 728
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
resource_manager/client: Don't set token as -1
in burstable mode
#6216
resource_manager/client: Don't set token as -1
in burstable mode
#6216
Conversation
Signed-off-by: Cabinfever_B <[email protected]>
Signed-off-by: Cabinfever_B <[email protected]>
Signed-off-by: Cabinfever_B <[email protected]>
Signed-off-by: Cabinfever_B <[email protected]>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #6216 +/- ##
==========================================
+ Coverage 74.71% 74.77% +0.06%
==========================================
Files 395 395
Lines 38826 38846 +20
==========================================
+ Hits 29008 29048 +40
+ Misses 7274 7261 -13
+ Partials 2544 2537 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 28 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
fillRate := getRUTokenBucketSetting(gc.ResourceGroup, typ) | ||
cfg.NewBurst = int64(fillRate.Settings.FillRate) | ||
cfg.NewRate = float64(fillRate.Settings.FillRate) | ||
tb := counter.getTokenBucketFunc() |
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.
maybe can directly get fillrate?
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.
fix
fillRate := getRawResourceTokenBucketSetting(gc.ResourceGroup, typ) | ||
cfg.NewBurst = int64(fillRate.Settings.FillRate) | ||
cfg.NewRate = float64(fillRate.Settings.FillRate) | ||
tb := counter.getTokenBucketFunc() |
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.
ditto
lim.limit = Limit(args.NewRate) | ||
lim.burst = args.NewBurst | ||
_, _, lim.tokens = lim.advance(now) |
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.
why not advance before lim.last = now
?
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.
I was trying to avoid accumulating too many tokens when burst is -1. Because the first advance
was before the burst changes, we want to advance
after the burst changes.
But I feel this worry is unnecessary, I will delete this line
Signed-off-by: Cabinfever_B <[email protected]>
Signed-off-by: Cabinfever_B <[email protected]>
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
@@ -334,6 +334,114 @@ func (suite *resourceManagerClientTestSuite) TestResourceGroupController() { | |||
controller.Stop() | |||
} | |||
|
|||
// TestSwitchBurst is used to test https://github.com/tikv/pd/issue/6209 |
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.
#6209
issues
miss a s
:)
Signed-off-by: Cabinfever_B <[email protected]>
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.
REST LGTM!
// In the non-trickle case, clients can be allowed to accumulate more tokens. | ||
if cfg.NewBurst >= 0 { | ||
cfg.NewBurst = 0 | ||
cfg.NotifyThreshold = math.Min((granted+counter.limiter.AvailableTokens(gc.run.now)), counter.avgRUPerSec*defaultTargetPeriod.Seconds()) * notifyFraction |
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.
redundant bracket
lim.tokens = tokens + args.NewTokens | ||
log.Debug("[resource group controller] before reconfigure", zap.Float64("NewTokens", lim.tokens), zap.Float64("NewRate", float64(lim.limit)), zap.Float64("NotifyThreshold", args.NotifyThreshold), zap.Int64("burst", lim.burst)) | ||
if args.NewBurst < 0 { | ||
lim.tokens = args.NewTokens |
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 annotation for the limiter field last
is last is the last time the token field of the limiter was updated
So for this change do we need to update annotation or will this cause some unexpect behavior?
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.
I changed it and will update last
here as well
@HuSharp: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Signed-off-by: Cabinfever_B <[email protected]>
/merge |
@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 279124d
|
In response to a cherrypick label: new pull request created to branch |
…ikv#6216) close tikv#6209, ref tikv#6209 Signed-off-by: Cabinfever_B <[email protected]>
…ikv#6216) close tikv#6209, ref tikv#6209 Signed-off-by: Cabinfever_B <[email protected]>
…6216) (#6220) close #6209, ref #6209, ref #6216 Signed-off-by: Cabinfever_B <[email protected]> Co-authored-by: Yongbo Jiang <[email protected]>
What problem does this PR solve?
Issue Number: Close #6209
What is changed and how does it work?
Before this PR, the token of limiter is set to
-1
in burst mode. But ref #6209, after stopping workload, the avg will be zore. So the required token will be zero. If we disable burstable, the token and fillratre are both zero, so workload can not run.This PR block token refill when in burstable mode and keep the token as FillRate.
Check List
Tests
Release note