Skip to content
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

scheduelrs: add load expectations for hot scheudler #2297

Merged
merged 4 commits into from
Mar 28, 2020

Conversation

nolouch
Copy link
Contributor

@nolouch nolouch commented Mar 28, 2020

Signed-off-by: nolouch nolouch@gmail.com

What problem does this PR solve?

To prevent excessive redundant scheduling
image

What is changed and how it works?

add the avg load as an expectation.

Release note

Check List

Tests

  • Unit test
  • Manual test
    the scheduler operator is reduced and QPS is stable.
    image

Signed-off-by: nolouch <nolouch@gmail.com>
@nolouch nolouch added the component/schedule Scheduling logic. label Mar 28, 2020
@nolouch nolouch added this to the v4.0.0-rc milestone Mar 28, 2020
@nolouch nolouch added the priority/P1 The issue has P1 priority. label Mar 28, 2020
Signed-off-by: nolouch <nolouch@gmail.com>
@codecov-io
Copy link

Codecov Report

Merging #2297 into master will increase coverage by 0.30%.
The diff coverage is 89.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2297      +/-   ##
==========================================
+ Coverage   76.25%   76.56%   +0.30%     
==========================================
  Files         199      201       +2     
  Lines       21591    21803     +212     
==========================================
+ Hits        16464    16693     +229     
+ Misses       3891     3883       -8     
+ Partials     1236     1227       -9     
Impacted Files Coverage Δ
server/schedulers/utils.go 92.13% <ø> (ø)
server/server.go 81.25% <33.33%> (+0.79%) ⬆️
server/cluster/cluster.go 81.40% <50.00%> (+0.53%) ⬆️
server/grpc_service.go 57.26% <50.00%> (-1.29%) ⬇️
tools/pd-ctl/pdctl/command/component_command.go 63.54% <58.33%> (-0.51%) ⬇️
pkg/dashboard/servers.go 87.50% <80.00%> (+23.86%) ⬆️
pkg/dashboard/manager.go 85.84% <85.84%> (ø)
pkg/dashboard/apiserver.go 73.91% <100.00%> (ø)
pkg/dashboard/redirector.go 100.00% <100.00%> (ø)
pkg/mock/mockcluster/mockcluster.go 91.12% <100.00%> (+0.21%) ⬆️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c709cf...2cc7db5. Read the comment docs.

@@ -42,6 +42,7 @@ func initHotRegionScheduleConfig() *hotRegionSchedulerConfig {
GreatDecRatio: 0.95,
MinorDecRatio: 0.99,
MaxPeerNum: 1000,
ToleranceRatio: 1.02,
Copy link
Member

Choose a reason for hiding this comment

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

Why 1.02?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

2%

@@ -420,10 +426,13 @@ func (mc *Cluster) UpdateStorageReadBytes(storeID uint64, bytesRead uint64) {
}

// UpdateStorageWrittenKeys updates store written keys.
func (mc *Cluster) UpdateStorageWrittenKeys(storeID uint64, keysWritten uint64) {
func (mc *Cluster) UpdateStorageWrittenKeys(storeID uint64, keysWritten uint64, updateSingleOption ...struct{}) {
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:

Suggested change
func (mc *Cluster) UpdateStorageWrittenKeys(storeID uint64, keysWritten uint64, updateSingleOption ...struct{}) {
func (mc *Cluster) UpdateStorageWrittenStats(storeID uint64, keysWritten uint64, bytesWritten uint64) {

Copy link
Contributor

@lhy1024 lhy1024 left a comment

Choose a reason for hiding this comment

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

the rest LGTM

// Only consider about count and key rate.
if srcLd.Count > dstLd.Count &&
srcLd.KeyRate >= dstLd.KeyRate+peer.GetKeyRate() {
// Only consider about key rate.
Copy link
Contributor

Choose a reason for hiding this comment

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

What is its effect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The srcCount may higher but the keyRate lower.

@nolouch
Copy link
Contributor Author

nolouch commented Mar 28, 2020

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 28, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Mar 28, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 28, 2020

@nolouch merge failed.

@lhy1024
Copy link
Contributor

lhy1024 commented Mar 28, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 28, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 28, 2020

@nolouch merge failed.

@lhy1024
Copy link
Contributor

lhy1024 commented Mar 28, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 28, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Mar 28, 2020

@nolouch merge failed.

@nolouch
Copy link
Contributor Author

nolouch commented Mar 28, 2020

/run-all-tests

@nolouch nolouch merged commit a63cf42 into tikv:master Mar 28, 2020
@nolouch nolouch deleted the exp-hot-region branch March 28, 2020 17:44
hsqlu pushed a commit to hsqlu/pd that referenced this pull request Mar 29, 2020
* scheduelrs: add load expectations for hot scheudler

Signed-off-by: nolouch <nolouch@gmail.com>
nolouch added a commit to nolouch/pd that referenced this pull request Apr 10, 2020
* scheduelrs: add load expectations for hot scheudler

Signed-off-by: nolouch <nolouch@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/schedule Scheduling logic. priority/P1 The issue has P1 priority. status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants