-
Notifications
You must be signed in to change notification settings - Fork 720
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
scheduler: introduce the rank interface #8353
Conversation
@@ -0,0 +1,243 @@ | |||
// Copyright 2017 TiKV Project Authors. |
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.
// Copyright 2017 TiKV Project Authors. | |
// Copyright 2024 TiKV Project Authors. |
/test ? |
@rleungx: The following commands are available to trigger required jobs:
The following commands are available to trigger optional jobs:
Use
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. |
/test pull-integration-realcluster-test |
What problem does this PR solve?🤔 |
998fffa
to
a48ee63
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8353 +/- ##
==========================================
+ Coverage 77.34% 77.36% +0.01%
==========================================
Files 471 472 +1
Lines 61914 61903 -11
==========================================
Hits 47890 47890
+ Misses 10448 10434 -14
- Partials 3576 3579 +3
Flags with carried forward coverage won't be shown. Click here to find out more. |
// for metrics | ||
for storeID, info := range storeInfos { | ||
storeLabel := strconv.FormatUint(storeID, 10) | ||
if infl := info.PendingSum; infl != nil && len(infl.Loads) != 0 { | ||
utils.ForeachRegionStats(func(rwTy utils.RWType, dim int, kind utils.RegionStatKind) { | ||
setHotPendingInfluenceMetrics(storeLabel, rwTy.String(), utils.DimToString(dim), infl.Loads[kind]) | ||
HotPendingSum.WithLabelValues(storeLabel, rwTy.String(), utils.DimToString(dim)).Set(infl.Loads[kind]) | ||
}) | ||
} | ||
} | ||
} | ||
|
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 better to wrap a function for these codes
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 think it's unnecessary.
@@ -533,19 +535,8 @@ type balanceSolver struct { | |||
maxPeerNum int | |||
minHotDegree int | |||
|
|||
firstPriorityV2Ratios *rankV2Ratios | |||
secondPriorityV2Ratios *rankV2Ratios | |||
|
|||
// The rank correlation function used according to the version |
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.
Is this note still needed?
default: | ||
bs.initRankV2() | ||
bs.rank = initRankV2(bs, bs.greatDecRatio) |
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 input bs only?
rankToDimString func() string | ||
checkByPriorityAndTolerance func(loads []float64, f func(int) bool) bool | ||
checkHistoryLoadsByPriority func(loads [][]float64, f func(int) bool) bool | ||
rank rank |
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 this?
rank rank | |
rank |
} | ||
|
||
func (*rankV1) needSearchRevertRegions() bool { return false } | ||
func (*rankV1) setSearchRevertRegions() {} |
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.
🤔
func (*rankV1) setSearchRevertRegions() {} | |
func (*rankV1) setSearchRevertRegions() {} |
@@ -59,7 +51,7 @@ type balanceChecker struct { | |||
// If the ratio is between the two, it is considered to be in the pre-balanced state. | |||
|
|||
// TODO: Unified with stddevThreshold. | |||
type rankV2Ratios struct { | |||
type rankRatios struct { |
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.
please update all rankV2Ratios to rankRatios
} | ||
|
||
// pickCheckPolicyV2 will set checkByPriorityAndTolerance to the corresponding function. | ||
// Note: PolicyV2 will search more possible solutions than PolicyV1. | ||
// so it allows to schedule when any of the two dimensions is not balanced. | ||
func (bs *balanceSolver) pickCheckPolicyV2() { | ||
func (r *rankV2) checkHistoryLoadsByPriority(loads [][]float64, f func(int) bool) bool { |
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.
please update comment
} | ||
} | ||
|
||
// filterUniformStoreV2 filters stores by stddev. | ||
// stddev is the standard deviation of the store's load for all stores. | ||
func (bs *balanceSolver) filterUniformStoreV2() (string, bool) { | ||
if !bs.enableExpectation() { | ||
func (r *rankV2) filterUniformStore() (string, bool) { |
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
bs.cur.calcPeersRate(bs.firstPriority, bs.secondPriority) | ||
if bs.cur.getPeersRateFromCache(bs.firstPriority) < bs.getMinRate(bs.firstPriority) && | ||
bs.cur.getPeersRateFromCache(bs.secondPriority) < bs.getMinRate(bs.secondPriority) { | ||
func (r *rankV2) calcProgressiveRank() { |
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
@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. |
c477490
to
f5e0b4b
Compare
futureChecker: futureStateChecker, | ||
currentChecker: currentStateChecker, | ||
perceivedRatio: perceivedRatio, minHotRatio: minHotRatio} | ||
|
||
return rs | ||
} | ||
|
||
func (bs *balanceSolver) initRankV2() { | ||
bs.firstPriorityV2Ratios = newRankV2Ratios(bs.sche.conf.GetGreatDecRatio(), firstPriorityPerceivedRatio, firstPriorityMinHotRatio) | ||
// The second priority is less demanding. Set the preBalancedRatio of the first priority to the balancedRatio of the second dimension. |
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.
Do we need to keep this comment?
Signed-off-by: Ryan Leung <rleungx@gmail.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: HuSharp, lhy1024, okJiang 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