当前位置:网站首页>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存在明显的写热点,而其他几张表的插入显的较为平均
后续更新
边栏推荐
- CS0006 C# 未能找到元数据文件“C:\Users\...问题
- Bentley uses authing to quickly integrate application system and identity
- tidb-lightning配置数据还原路由
- C language: use H and C. summary of problems encountered in documents
- Go get downloaded package path
- Computing philosophy behind authoring
- 《DAMA数据管理知识体系指南》:章节分值占比
- TypeScipt基础
- How does Sister Feng change to ice?
- 合并两个有序链表---2022/02/24
猜你喜欢

05_ Feature Engineering - dimension reduction

Vscode automatic eslint formatting when saving code

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

RecyclerView缓存复用解析,源码解读

Dynamic: capturing network dynamics using dynamic graph representation learning

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

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

ffmpeg硬编解码 Inter QSV

Use of forcescan in SQL server and precautions

ffmpeg奇偶场帧Interlace progressive命令和代码处理
随机推荐
threejs利用indexeddb缓存加载glb模型
Authing biweekly news: authing forum launched (4.25-5.8)
6-8 创建、遍历链表
Real time myth -- real-time RTOS multitask performance analysis
子类继承了什么、多态、 向上转型
LeetCode-384. Scramble array
MATLAB中histogram函数的使用
05_特征工程—降维
合并两个有序链表---2022/02/24
定制 or 订阅?未来中国 SaaS 行业发展趋势是什么?
Authing 双周动态:Authing 论坛上线(4.25-5.8)
搜狐全员遭诈骗,暴露哪些问题?
DFS and BFS notes (I) breadth first search based on C language
ffmpeg硬件编解码Nvidia GPU
LeetCode——42. Connected to rainwater (double pointer)
vscode配置eslint自动格式化报错“Auto Fix is enabled by default. Use the single string form“
Arraylist集合、对象数组
Config: user attribute configuration framework
6-5 统计单词数量(文件)(*)
spawn ./gradlew EACCES at Process.ChildProcess._handle.onexit