没有任何的业务操作,PD的CPU单核 平均50%

【TiDB 使用环境】测试
【TiDB 版本】8.0.0
【操作系统】ubuntu 22.04|20.04
【部署方式】机器部署(32C64G)
【集群数据量】5G
【集群节点数】1pd1kv1tidb
cpu占比
|8.06s (48%)|8.05s (48%)|math/rand.(*rngSource).Seed|
|750.00ms (4.4%)|750.00ms (4.4%)|runtime.greyobject|
|1.58s (9.4%)|700.00ms (4.1%)|runtime.mallocgc|
调用关系
math/rand.(*rngSource).Seed (/usr/local/go/src/math/rand/rng.go:204)

github.com/tikv/pd/pkg/schedule/filter.NewCandidates (/workspace/source/pd/pkg/schedule/filter/candidates.go:35)
github.com/tikv/pd/pkg/schedule/checker.(*ReplicaStrategy).SelectStoreToAdd (/workspace/source/pd/pkg/schedule/checker/replica_strategy.go:48)
github.com/tikv/pd/pkg/schedule/checker.(*RuleChecker).addRulePeer (/workspace/source/pd/pkg/schedule/checker/rule_checker.go:230)
github.com/tikv/pd/pkg/schedule/checker.(*RuleChecker).fixRulePeer (/workspace/source/pd/pkg/schedule/checker/rule_checker.go:192)
github.com/tikv/pd/pkg/schedule/checker.(*RuleChecker).CheckWithFit (/workspace/source/pd/pkg/schedule/checker/rule_checker.go:122)
github.com/tikv/pd/pkg/schedule/checker.(*Controller).CheckRegion (/workspace/source/pd/pkg/schedule/checker/checker_controller.go:76)
github.com/tikv/pd/pkg/schedule.(*Coordinator).tryAddOperators (/workspace/source/pd/pkg/schedule/coordinator.go:290)
github.com/tikv/pd/pkg/schedule.(*Coordinator).checkRegions (/workspace/source/pd/pkg/schedule/coordinator.go:194)
github.com/tikv/pd/pkg/schedule.(*Coordinator).PatrolRegions (/workspace/source/pd/pkg/schedule/coordinator.go:140)
看这个调用栈,并没有发现哪里有随机操作呢,用的dashboard-【高级调试】-【手动分析】功能?想知道哪里导致空闲时CPU过高,怎么处理呢?

pd 有一些 rules check、region 心跳等日常工作。
因此一般没有压力的时候 0.5vc-1.5vc 是正常的。

如果 region 数量非常多(上百万),tidb-server 也很多(一些定期刷 region cache 等),配置了比较复杂的 placment rules 或者开启了一些 scatter 特性,空闲时 cpu 会更多。都很正常。

1 个赞

:thinking:是混合部署么?

单机混合部署的话,这个问题估计是符合预期的~

单机部署,这么一点数据就0.5vc :dotted_line_face:

关键我这里数据不多,1PD1KV1TIDB 呢

定时任务耗点也正常。
其实有些参数调整之后也能降,但是感觉没必要,何必扣那 1vc

担心的是这点数据就1vc 有点多啊。 我空了再加点数据看看