From 894172a150c4a524d9881b128496b486219b6ace Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Sun, 19 Nov 2023 16:02:59 +0800 Subject: [PATCH 1/2] domain: randomly trigger the DumpStatsDeltaToKV Signed-off-by: Weizhen Wang --- domain/domain.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/domain/domain.go b/domain/domain.go index f41a5dcc634b9..fe37eb45edf74 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -1990,7 +1990,8 @@ func (do *Domain) syncIndexUsageWorker(owner owner.Manager) { func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager) { defer util.Recover(metrics.LabelDomain, "updateStatsWorker", nil, false) lease := do.statsLease - deltaUpdateTicker := time.NewTicker(20 * lease) + randDuration := time.Duration(rand.Int63n(int64(time.Minute))) + deltaUpdateTicker := time.NewTicker(20*lease + randDuration) gcStatsTicker := time.NewTicker(100 * lease) dumpFeedbackTicker := time.NewTicker(200 * lease) loadFeedbackTicker := time.NewTicker(5 * lease) From 6e33eb2615cbd994908b49b68f8466966eddca8b Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 20 Nov 2023 09:24:24 +0800 Subject: [PATCH 2/2] update Signed-off-by: Weizhen Wang --- domain/domain.go | 1 + 1 file changed, 1 insertion(+) diff --git a/domain/domain.go b/domain/domain.go index fe37eb45edf74..e1cba50ba9fbe 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -1990,6 +1990,7 @@ func (do *Domain) syncIndexUsageWorker(owner owner.Manager) { func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager) { defer util.Recover(metrics.LabelDomain, "updateStatsWorker", nil, false) lease := do.statsLease + // We need to have different nodes trigger tasks at different times to avoid the herd effect. randDuration := time.Duration(rand.Int63n(int64(time.Minute))) deltaUpdateTicker := time.NewTicker(20*lease + randDuration) gcStatsTicker := time.NewTicker(100 * lease)