tidb-server CPU占用一直很高

使用top命令,看到 tidb-server的CPU占用一直保持在 430% 以上,使用 perf top 查看,前几条如下,请问这个是正常的吗? 数据量不大,访问量也不大。TiDB版本是 4.0.3
Release Version: v4.0.3
Edition: Community
Git Commit Hash: 0529b1b493e46aae71bbe34cbe24515a2eb1b47c
Git Branch: heads/refs/tags/v4.0.3
UTC Build Time: 2020-07-24 12:06:35
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

15.67% tidb-server [.] runtime.mallocgc
9.97% tidb-server [.] runtime.mapaccess2_faststr
7.78% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*MySQLPrivilege).RequestVerification
5.75% tidb-server [.] github.com/pingcap/tidb/util/stringutil.DoMatch
4.90% tidb-server [.] runtime.scanobject
4.18% tidb-server [.] memeqbody
3.99% tidb-server [.] strings.ToUpper
3.74% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*baseRecord).match
3.61% tidb-server [.] runtime.heapBitsSetType
2.85% tidb-server [.] runtime.makeslice
2.77% tidb-server [.] github.com/pingcap/tidb/executor.(*hugeMemTableRetriever).setDataForColumns
2.42% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*UserPrivileges).RequestVerification
2.10% tidb-server [.] runtime.greyobject
1.94% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*MySQLPrivilege).matchTables
1.92% tidb-server [.] runtime.growslice
1.82% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*MySQLPrivilege).FindAllRole
1.73% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*MySQLPrivilege).matchDB
1.71% tidb-server [.] runtime.findObject
1.41% tidb-server [.] runtime.fastrand
1.40% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*dbRecord).match
1.24% tidb-server [.] strings.ToLower
1.19% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*MySQLPrivilege).matchUser
1.15% tidb-server [.] strings.EqualFold
1.05% tidb-server [.] runtime.memequal
1.03% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*tablesPrivRecord).match
0.89% tidb-server [.] runtime.memclrNoHeapPointers
0.86% tidb-server [.] runtime.duffzero
0.76% tidb-server [.] aeshashbody
0.65% tidb-server [.] github.com/pingcap/tidb/privilege/privileges.(*MySQLPrivilege).matchColumns

  1. 请问是物理机还是虚拟机,比如阿里云
  2. 麻烦反馈几个 top 截图,多谢。
  3. 当前拓扑有几个 tidb-server,都是 cpu高吗?
  1. 是一台物理服务器,虚拟了几个虚拟机
  2. 如下图
  3. 当前有2个tidb-server,其中一个430%以上,一个在120%以上

tidb-1
tidb-2

你好,目前这两个 TiDB 的负载情况具体是什么样的?有多少个 client connection?

麻烦帮忙抓一下 debug 信息

curl http://tidb_ip:tidb_status_port/debug/zip --output tidb_debug.zip
例如
curl http://127.0.0.1:10080/debug/zip --output tidb_debug.zip

上传

看起来可能和这个问题类似。

client connection 一个是 46(CPU 120%) 一个是50(CPU 430%)

tidb_debug.zip (520.1 KB)

tidb_debug-430.zip (586.6 KB)

应该就是这个问题,我执行了 grant select on . to ‘user1’@’%’; 后,CPU就下来了

:+1:

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。