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
Conversation
Signed-off-by: lhy1024 <admin@liudos.us>
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Codecov ReportBase: 75.62% // Head: 75.66% // Increases project coverage by
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
Flags with carried forward coverage won't be shown. Click here to find out 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. |
server/statistics/hot_peer_cache.go
Outdated
@@ -60,6 +60,14 @@ var MinHotThresholds = [RegionStatCount]float64{ | |||
RegionWriteQueryNum: 32, | |||
} | |||
|
|||
// DefaultThresholdsUpdateInterval is the default interval to update thresholds. | |||
var DefaultThresholdsUpdateInterval = StoreHeartBeatReportInterval * time.Second |
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.
- the
StoreHeartBeatReportInterval
can be adjusted by tikv config - the refresh interval should be less than store hearbeat interval to keep the next calculate must use the latest threshold?
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 will make store heartbeat interval sync with tikv in another pr.
- Good idea
server/statistics/hot_peer_cache.go
Outdated
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 { |
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.
Will it affect the write threshold?
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, 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>
server/statistics/hot_peer_cache.go
Outdated
@@ -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 |
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 putting them into the same place with StoreHeartBeatReportInterval
and 8s directly?
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 cannot be const, because tests need.
Signed-off-by: lhy1024 <admin@liudos.us>
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.
rest LGTM
Signed-off-by: lhy1024 <admin@liudos.us>
/merge |
@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. |
This pull request has been accepted and is ready to merge. Commit hash: 26e670a
|
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
Release note