-
Notifications
You must be signed in to change notification settings - Fork 740
scheduler: add more hot scheduler comments and replace negative rank #8345
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
Conversation
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8345 +/- ##
==========================================
+ Coverage 77.33% 77.36% +0.02%
==========================================
Files 472 472
Lines 61802 61799 -3
==========================================
+ Hits 47793 47808 +15
+ Misses 10430 10419 -11
+ Partials 3579 3572 -7
Flags with carried forward coverage won't be shown. Click here to find out more. |
/test pull-integration-realcluster-test |
// | ↓ firstPriority \ secondPriority → | isBetter | isNotWorsened | Worsened | | ||
// | isBetter | 4 | 3 | 1 | | ||
// | isNotWorsened | 2 | -1 | -1 | | ||
// | Worsened | 0 | -1 | -1 | | ||
func (bs *balanceSolver) calcProgressiveRankV1() { |
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.
How about using variables to represent instead of magic numbers?
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.
It is the score to be used for comparing.
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.
Yes, it is. But it is still being used in many places for making judgments, which indeed can be hard to understand in the code, so more comments have to be added to explain it. Like these
pd/pkg/schedule/schedulers/hot_region.go
Lines 1373 to 1393 in cbba49a
switch bs.cur.progressiveRank { | |
case -4: // isBetter(firstPriority) && isBetter(secondPriority) | |
if firstCmp != 0 { | |
return firstCmp > 0 | |
} | |
return secondCmp > 0 | |
case -3: // isBetter(firstPriority) && isNotWorsened(secondPriority) | |
if firstCmp != 0 { | |
return firstCmp > 0 | |
} | |
// prefer smaller second priority rate, to reduce oscillation | |
return secondCmp < 0 | |
case -2: // isNotWorsened(firstPriority) && isBetter(secondPriority) | |
if secondCmp != 0 { | |
return secondCmp > 0 | |
} | |
// prefer smaller first priority rate, to reduce oscillation | |
return firstCmp < 0 | |
case -1: // isBetter(firstPriority) | |
return firstCmp > 0 | |
// TODO: The smaller the difference between the value and the expectation, the better. |
I feel like it's really hard to name, so I'm just suggesting something and not rushing to solve it. :)
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
// Metric for debug. | ||
// TODO: pre-allocate gauge metrics | ||
ty := "byte-rate-" + rwTy.String() + "-" + kind.String() | ||
hotPeerSummary.WithLabelValues(ty, fmt.Sprintf("%v", id)).Set(peerLoadSum[utils.ByteDim]) |
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.
no need any more?
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.
Yeah, we haven't been using this metrics
Signed-off-by: lhy1024 <admin@liudos.us>
@okJiang: adding LGTM is restricted to approvers and reviewers in OWNERS files. 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 kubernetes/test-infra repository. |
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@@ -38,7 +38,6 @@ import ( | |||
) | |||
|
|||
const ( | |||
|
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.
Because modify config file, PTAL cc @niubell
/test pull-integration-realcluster-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: HuSharp, niubell, okJiang, rleungx The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: Ref #5691
What is changed and how does it work?
Check List
Tests
Release note