-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
*: avoid thundering herd problem when timeout the stats sync load #50956
*: avoid thundering herd problem when timeout the stats sync load #50956
Conversation
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #50956 +/- ##
================================================
+ Coverage 72.2645% 72.5844% +0.3199%
================================================
Files 1466 1466
Lines 361209 434144 +72935
================================================
+ Hits 261026 315121 +54095
- Misses 80918 99112 +18194
- Partials 19265 19911 +646
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -196,7 +197,10 @@ func (s *statsSyncLoad) SubLoadWorker(sctx sessionctx.Context, exit chan struct{ | |||
case errExit: | |||
return | |||
default: | |||
time.Sleep(s.statsHandle.Lease() / 10) | |||
// To avoid the thundering herd effect |
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 seems that sync load tasks are processed sequentially here, and a single sync load task is not concurrent. So why does the thundering herd effect occur?
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.
stats-load-concurrency
controls the concurrency of sync load. at default, it will create 5 concurrency to work for it.
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.
so if we have a large tidb cluster, it is easy that many node have to retry at the same time.
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, elsa0520, winoros 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 |
/cherrypick release-7.5 |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@hawkingrei: new pull request created to branch 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 ti-community-infra/tichi repository. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@hawkingrei: new pull request created to branch 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 ti-community-infra/tichi repository. |
@hawkingrei: new pull request created to branch 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 ti-community-infra/tichi repository. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #50957
Problem Summary:
What changed and how does it work?
we need to load the stats cache in the background. but if we meet the timeout, we must wait constantly to retry. it will happen thundering herd. so we need to add the rand sleep to prevent it.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.