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

statistics: cached thresholds in hot peer cache #5728

Merged
merged 9 commits into from Nov 25, 2022

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Nov 23, 2022

Signed-off-by: lhy1024 admin@liudos.us

What problem does this PR solve?

Issue Number: Ref #5692

What is changed and how does it work?

It is a part of #5721

Check List

Tests

  • Unit test

Release note

None.

Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 23, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bufferflies
  • rleungx

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@codecov
Copy link

codecov bot commented Nov 23, 2022

Codecov Report

Base: 75.62% // Head: 75.66% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (9914c9b) compared to base (7593af1).
Patch coverage: 89.28% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5728      +/-   ##
==========================================
+ Coverage   75.62%   75.66%   +0.04%     
==========================================
  Files         329      329              
  Lines       32777    32786       +9     
==========================================
+ Hits        24786    24807      +21     
+ Misses       5844     5837       -7     
+ Partials     2147     2142       -5     
Flag Coverage Δ
unittests 75.66% <89.28%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
server/statistics/hot_cache.go 86.36% <62.50%> (-2.67%) ⬇️
server/statistics/hot_peer_cache.go 96.96% <100.00%> (+0.03%) ⬆️
pkg/dashboard/adapter/manager.go 74.71% <0.00%> (-6.90%) ⬇️
server/storage/kv/etcd_kv.go 79.71% <0.00%> (-5.80%) ⬇️
server/tso/tso.go 69.66% <0.00%> (-4.50%) ⬇️
server/schedule/labeler/rules.go 87.50% <0.00%> (-2.28%) ⬇️
server/statistics/hot_peer.go 98.36% <0.00%> (-1.64%) ⬇️
server/encryptionkm/key_manager.go 70.11% <0.00%> (-1.60%) ⬇️
server/schedule/operator/step.go 73.09% <0.00%> (-0.72%) ⬇️
server/schedule/operator_controller.go 86.48% <0.00%> (-0.68%) ⬇️
... and 15 more

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 at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -60,6 +60,14 @@ var MinHotThresholds = [RegionStatCount]float64{
RegionWriteQueryNum: 32,
}

// DefaultThresholdsUpdateInterval is the default interval to update thresholds.
var DefaultThresholdsUpdateInterval = StoreHeartBeatReportInterval * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. the StoreHeartBeatReportInterval can be adjusted by tikv config
  2. the refresh interval should be less than store hearbeat interval to keep the next calculate must use the latest threshold?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. I will make store heartbeat interval sync with tikv in another pr.
  2. Good idea

for i := range ret {
ret[i] = math.Max(tn.GetTopNMin(i).(*HotPeerStat).GetLoad(i)*HotThresholdRatio, ret[i])
thresholds, ok := f.thresholdsOfStore[storeID]
if ok && time.Since(thresholds.updatedTime) <= DefaultThresholdsUpdateInterval {
Copy link
Member

@rleungx rleungx Nov 24, 2022

Choose a reason for hiding this comment

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

Will it affect the write threshold?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but less interval means update more frequently, so it will only make write cache more accurate

Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@@ -60,6 +60,15 @@ var MinHotThresholds = [RegionStatCount]float64{
RegionWriteQueryNum: 32,
}

// DefaultThresholdsUpdateInterval is the default interval to update thresholds.
// the refresh interval should be less than store heartbeat interval to keep the next calculate must use the latest threshold.
var DefaultThresholdsUpdateInterval = StoreHeartBeatReportInterval * 0.8 * time.Second
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 putting them into the same place with StoreHeartBeatReportInterval and 8s directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It cannot be const, because tests need.

server/statistics/hot_peer_cache.go Outdated Show resolved Hide resolved
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 25, 2022
Signed-off-by: lhy1024 <admin@liudos.us>
Copy link
Contributor

@bufferflies bufferflies left a comment

Choose a reason for hiding this comment

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

rest LGTM

Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 25, 2022
@lhy1024
Copy link
Contributor Author

lhy1024 commented Nov 25, 2022

/merge

@ti-chi-bot
Copy link
Member

@lhy1024: 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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 26e670a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 25, 2022
@ti-chi-bot ti-chi-bot merged commit cdcce2d into tikv:master Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants