当前位置:网站首页>tidb-写热点的测试及分析
tidb-写热点的测试及分析
2022-06-11 17:19:00 【与数据交流的路上】
一、写热点现象
1.通过grafana中的TiKV-Trouble-Shooting 中 Hot Write 面板的raft store cpu观测是否有单节点的cpu高于其他节点
2.dashboard中写热点图呈现如下状态

二、解决写入热点的几种方法
- 建表的时候采用SHARD_ROW_ID_BITS 和PRE_SPLIT_REGIONS
- 使用auto_random来代替auto_inccrement
三、测试及验证
1.建表语句
create table write_hot_1(id bigint(20) not null auto_increment primary key,z_name varchar(20),z_info varchar(30));
create table write_hot_2(id bigint(20) not null auto_random primary key,z_name varchar(20),z_info varchar(30));
create table write_hot_3 (id bigint(20), z_name varchar(20), z_info varchar(30)) SHARD_ROW_ID_BITS = 4 PRE_SPLIT_REGIONS=3;
create table write_hot_4(id bigint(20) not null auto_random primary key,z_name varchar(20),z_info varchar(30) , key idx_z_name(z_name));
2.插入脚本
import pymysql
conn = pymysql.Connect(host="", port=, user="", password="", db='')
cur = conn.cursor()
sql_str = 'insert into write_hot_4(z_name, z_info) values("csdfsdfsdfsda", "qwwerwerisdfnsdvj vsd")'
for i in range(10000):
sql_str = sql_str + ',("csdfsdfsdfsda", "qwwerwerisdfnsdvj vsd")'
for i in range(1000):
print(i)
cur.execute(sql_str)
conn.commit()
conn.close()
3.写入热力图

4.查看每张表的region分布情况
show table write_hot_1 regions;
show table write_hot_2 regions;
show table write_hot_3 regions;
show table write_hot_4 regions;
四、结论
通过热力图可以看出write_hot_1存在明显的写热点,而其他几张表的插入显的较为平均
后续更新
边栏推荐
- which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_ mod
- Dynamic: capturing network dynamics using dynamic graph representation learning
- 括号生成---2022/02/25
- av_read_frame返回值为-5 Input/output error
- What is the minimum change price of PTA futures? How can PTA futures be safe?
- 6-3 批量求和(*)
- Error: error summary of pointer as function parameter
- 10 times faster than 5g. Are you ready for 10 Gigabit communication?
- From a "trendsetter" to a "wind chaser", can master Kang still lead the market?
- Read and understand the development plan for software and information technology service industry during the "14th five year plan"
猜你喜欢

Authing biweekly news: online application market (5.10-5.22)

sql server中关于FORCESCAN的使用以及注意项

QLineEdit 设置输入掩码

活动 | Authing 首次渠道合作活动圆满落幕

Song of the sea in 5g Era

使用exe4j 将.jar文件打包为.exe文件

为什么udp流设置1316字节

The use of histogram function in MATLAB

Real time myth -- real-time RTOS multitask performance analysis

Analyze which should be tested in PMP and ACP with actual cases? Which is more useful?
随机推荐
Xie Yang, CEO of authing, was selected into Forbes' 30 under 30 Asia list in 2021
定制 or 订阅?未来中国 SaaS 行业发展趋势是什么?
TypeScipt基础
Create database instance
Derivation of child numbering formula for nodes numbered I in full k-ary tree
tidb-cdc同步mysql没有的特性到mysql时的处理
Bentley uses authing to quickly integrate application system and identity
Leetcode力扣刷题
LeetCode-384. Scramble array
From a "trendsetter" to a "wind chaser", can master Kang still lead the market?
Real time myth -- real-time RTOS multitask performance analysis
信息安全数学基础 Chapter 2——同余
JPA循环保存多个实体失败
tidb-cdc日志tables are not eligible to replicate
Environment configuration and pymysql installation
Use exe4j to convert The jar file is packaged as Exe file
6-3 读文章(*)
Char array parsing
From manufacturing to "intelligent manufacturing", explore the way for manufacturing enterprises to break the situation
JPA failed to save multiple entities circularly