TiDB5.0写入慢

【 TiDB 使用环境】
【概述】:TiDBv5.0.3 写入慢
【背景】:tidb 内有2张表 其中单表分别是20亿和170亿,进行数据压测 读性能已经符合要求,但写入差距太多


tikv 6个节点 3台pd 3台tidb 发现有通过 pc-ctl 发现有 leader 分配不均的情况 leader_count。
store
{
“count”: 6,
“stores”: [
{
“store”: {
“id”: 1,
“address”: “10.72.:20160”,
“labels”: [
{
“key”: “host”,
“value”: “10.72.”
}
],
“version”: “5.0.3”,
“status_address”: “10.72.:20180”,
“git_hash”: “63b63edfbb9bbf8aeb875aad28c59f082eeb55d4”,
“start_timestamp”: 1629097270,
“deploy_path”: “/data/tidb_hotel_archive/tidb-deploy/tikv-20160/bin”,
“last_heartbeat”: 1629340334836139832,
“state_name”: “Up”
},
“status”: {
“capacity”: “5.05TiB”,
“available”: “2.59TiB”,
“used_size”: “1.46TiB”,
“leader_count”: 54995,
“leader_weight”: 1,
“leader_score”: 54995,
“leader_size”: 4641625,
“region_count”: 150978,
“region_weight”: 1,
“region_score”: 13783251.782553354,
“region_size”: 12717974,
“start_ts”: “2021-08-16T15:01:10+08:00”,
“last_heartbeat_ts”: “2021-08-19T10:32:14.836139832+08:00”,
“uptime”: “67h31m4.836139832s”
}
},
{
“store”: {
“id”: 4,
“address”: “10.72:20160”,
“labels”: [
{
“key”: “host”,
“value”: “10.72”
}
],
“version”: “5.0.3”,
“status_address”: “10.72.:20180”,
“git_hash”: “63b63edfbb9bbf8aeb875aad28c59f082eeb55d4”,
“start_timestamp”: 1629097223,
“deploy_path”: “/data/tidb_hotel_archive/tidb-deploy/tikv-20160/bin”,
“last_heartbeat”: 1629340338785491459,
“state_name”: “Up”
},
“status”: {
“capacity”: “5.05TiB”,
“available”: “2.549TiB”,
“used_size”: “1.461TiB”,
“leader_count”: 55004,
“leader_weight”: 1,
“leader_score”: 55004,
“leader_size”: 4644902,
“region_count”: 150762,
“region_weight”: 1,
“region_score”: 13785688.260776015,
“region_size”: 12710782,
“start_ts”: “2021-08-16T15:00:23+08:00”,
“last_heartbeat_ts”: “2021-08-19T10:32:18.785491459+08:00”,
“uptime”: “67h31m55.785491459s”
}
},
{
“store”: {
“id”: 5,
“address”: “10.72.:20160”,
“labels”: [
{
“key”: “host”,
“value”: “10.72.”
}
],
“version”: “5.0.3”,
“status_address”: “10.72.:20180”,
“git_hash”: “63b63edfbb9bbf8aeb875aad28c59f082eeb55d4”,
“start_timestamp”: 1629097171,
“deploy_path”: “/data/tidb_hotel_archive/tidb-deploy/tikv-20160/bin”,
“last_heartbeat”: 1629340335247408270,
“state_name”: “Up”
},
“status”: {
“capacity”: “5.05TiB”,
“available”: “2.46TiB”,
“used_size”: “1.454TiB”,
“leader_count”: 0,
“leader_weight”: 1,
“leader_score”: 0,
“leader_size”: 0,
“region_count”: 150613,
“region_weight”: 1,
“region_score”: 13787552.67076299,
“region_size”: 12687569,
“start_ts”: “2021-08-16T14:59:31+08:00”,
“last_heartbeat_ts”: “2021-08-19T10:32:15.24740827+08:00”,
“uptime”: “67h32m44.24740827s”
}
},
{
“store”: {
“id”: 997041,
“address”: “10.72.:21160”,
“labels”: [
{
“key”: “host”,
“value”: “10.72.”
}
],
“version”: “5.0.3”,
“status_address”: “10.72:21180”,
“git_hash”: “63b63edfbb9bbf8aeb875aad28c59f082eeb55d4”,
“start_timestamp”: 1629098030,
“deploy_path”: “/data/tidb_hotel_archive/tidb-deploy/tikv-21160/bin”,
“last_heartbeat”: 1629340335117347438,
“state_name”: “Up”
},
“status”: {
“capacity”: “5.05TiB”,
“available”: “2.46TiB”,
“used_size”: “374.8GiB”,
“leader_count”: 29388,
“leader_weight”: 1,
“leader_score”: 29388,
“leader_size”: 2460488,
“region_count”: 39326,
“region_weight”: 1,
“region_score”: 3583862.2923073885,
“region_size”: 3297938,
“start_ts”: “2021-08-16T15:13:50+08:00”,
“last_heartbeat_ts”: “2021-08-19T10:32:15.117347438+08:00”,
“uptime”: “67h18m25.117347438s”
}
},
{
“store”: {
“id”: 1045195,
“address”: “10.72.:21160”,
“labels”: [
{
“key”: “host”,
“value”: “10.72”
}
],
“version”: “5.0.3”,
“status_address”: “10.72.:21180”,
“git_hash”: “63b63edfbb9bbf8aeb875aad28c59f082eeb55d4”,
“start_timestamp”: 1629166115,
“deploy_path”: “/data/tidb_hotel_archive/tidb-deploy/tikv-21160/bin”,
“last_heartbeat”: 1629340333880223794,
“state_name”: “Up”
},
“status”: {
“capacity”: “5.05TiB”,
“available”: “2.549TiB”,
“used_size”: “275.5GiB”,
“leader_count”: 25884,
“leader_weight”: 1,
“leader_score”: 25884,
“leader_size”: 2170521,
“region_count”: 29216,
“region_weight”: 1,
“region_score”: 2659850.2258474627,
“region_size”: 2452458,
“sending_snap_count”: 1,
“start_ts”: “2021-08-17T10:08:35+08:00”,
“last_heartbeat_ts”: “2021-08-19T10:32:13.880223794+08:00”,
“uptime”: “48h23m38.880223794s”
}
},
{
“store”: {
“id”: 1176627,
“address”: “10.72.:21160”,
“labels”: [
{
“key”: “host”,
“value”: “10.72”
}
],
“version”: “5.0.3”,
“status_address”: “10.72.:21180”,
“git_hash”: “63b63edfbb9bbf8aeb875aad28c59f082eeb55d4”,
“start_timestamp”: 1629265237,
“deploy_path”: “/data/tidb_hotel_archive/tidb-deploy/tikv-21160/bin”,
“last_heartbeat”: 1629340334862483693,
“state_name”: “Up”
},
“status”: {
“capacity”: “5.05TiB”,
“available”: “2.59TiB”,
“used_size”: “120.2GiB”,
“leader_count”: 12542,
“leader_weight”: 1,
“leader_score”: 12542,
“leader_size”: 1057089,
“region_count”: 12547,
“region_weight”: 1,
“region_score”: 1146017.1885642663,
“region_size”: 1057444,
“start_ts”: “2021-08-18T13:40:37+08:00”,
“last_heartbeat_ts”: “2021-08-19T10:32:14.862483693+08:00”,
“uptime”: “20h51m37.862483693s”
}
}
]
}
【现象】:业务和数据库现象
【问题】:当前遇到的问题
【业务影响】:
【TiDB 版本】:
【附件】:归档.zip (8.4 MB)

那两张表的写入性能都达不到要求么?

可以参考下,做些小调整:

https://asktug.com/t/topic/93819

写入慢一般都是热点问题,说明region 还不够打散,你参考下上面的文章,可以调整一下试试

1 个赞

写入的表你可以设计成只插入不更新

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