Skip to content

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

Merged
merged 12 commits into from
Jul 26, 2024

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Jun 27, 2024

What problem does this PR solve?

Issue Number: Ref #5691

What is changed and how does it work?

Check List

Tests

  • Unit test

Release note

None.

lhy1024 added 2 commits June 27, 2024 23:08
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 27, 2024
lhy1024 and others added 2 commits July 1, 2024 11:57
Signed-off-by: lhy1024 <admin@liudos.us>
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 94.91525% with 3 lines in your changes missing coverage. Please review.

Project coverage is 77.36%. Comparing base (2baee83) to head (635d720).
Report is 1 commits behind head on master.

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     
Flag Coverage Δ
unittests 77.36% <94.91%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@HuSharp
Copy link
Member

HuSharp commented Jul 3, 2024

/test pull-integration-realcluster-test

@ti-chi-bot ti-chi-bot bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 5, 2024
Comment on lines 1231 to 1235
// | ↓ firstPriority \ secondPriority → | isBetter | isNotWorsened | Worsened |
// | isBetter | 4 | 3 | 1 |
// | isNotWorsened | 2 | -1 | -1 |
// | Worsened | 0 | -1 | -1 |
func (bs *balanceSolver) calcProgressiveRankV1() {
Copy link
Member

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?

Copy link
Contributor Author

@lhy1024 lhy1024 Jul 15, 2024

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.

Copy link
Member

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

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. :)

lhy1024 added 2 commits July 15, 2024 18:07
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 25, 2024
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 25, 2024
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])
Copy link
Member

Choose a reason for hiding this comment

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

no need any more?

Copy link
Contributor Author

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>
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 25, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 25, 2024

@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>
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 25, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 25, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-25 09:04:32.030124632 +0000 UTC m=+1122294.021066100: ☑️ agreed by rleungx.
  • 2024-07-25 15:55:25.056457244 +0000 UTC m=+1146947.047398699: ☑️ agreed by HuSharp.

@@ -38,7 +38,6 @@ import (
)

const (

Copy link
Contributor Author

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

@lhy1024
Copy link
Contributor Author

lhy1024 commented Jul 26, 2024

/test pull-integration-realcluster-test

Copy link
Contributor

ti-chi-bot bot commented Jul 26, 2024

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Jul 26, 2024
@ti-chi-bot ti-chi-bot bot merged commit 024656b into tikv:master Jul 26, 2024
25 checks passed
@lhy1024 lhy1024 deleted the hot-comments branch July 26, 2024 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants