diff --git a/domain/domain.go b/domain/domain.go index f41a5dcc634b9..e1cba50ba9fbe 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -1990,7 +1990,9 @@ 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) + // 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) dumpFeedbackTicker := time.NewTicker(200 * lease) loadFeedbackTicker := time.NewTicker(5 * lease)