一、测试需求:
基于历史原因,我们的业务数据库一直使用5.4.3,最近由于研发提出需求:需要升级到6.5.3版本,基于版本不同,需要做个压力测试已验证2个版本之间的性能差异。
二、测试目的:
验证tidb数据库5.4.3和6.5.3版本性能的差异
三、测试结果:
tidb数据库6.5.3版本比5.4.3总体性能提升10%左右
四、以下是测试具体操作
1、集群环境
硬件配置
服务器为14台阿里云本地盘ssd服务器(选择的是NVME物理磁盘,不使用云盘,性能是5.5倍,具体测试请参考另外的文章)
| 服务器 | IP | CPU | 内存 | 
| PD | 172.16.0.139 | 4 vCore | 8G | 
| PD | 172.16.0.140 | 4 vCore | 8G | 
| PD | 172.16.0.141 | 4 vCore | 8G | 
| TIDB | 172.16.0.142 | 8 vCore | 16G | 
| TIDB | 172.16.0.143 | 8 vCore | 16G | 
| TIDB | 172.16.0.144 | 8 vCore | 16G | 
| TIDB | 172.16.0.145 | 8 vCore | 16G | 
| TIKV | 172.16.0.146 | 16 vCore | 64G | 
| TIKV | 172.16.0.147 | 16 vCore | 64G | 
| TIKV | 172.16.0.148 | 16 vCore | 64G | 
| TIKV | 172.16.0.149 | 16 vCore | 64G | 
| TIKV | 172.16.0.150 | 16 vCore | 64G | 
| TIKV | 172.16.0.151 | 16 vCore | 64G | 
| TIKV | 172.16.0.152 | 16 vCore | 64G | 
集群信息

2、TIDB版本:5.4.3
压测步骤
Sysbench 测试准备
sysbench主要对集群做基准测试,主要关注TPS、QPS
远程连接进入shell环境, 安装sysbench
[root@tsp-tidb-taos-01 ~]# yum install sysbench
[root@tsp-tidb-taos-01 ~]# sysbench --version
sysbench 1.0.17
建库 sbtest
[root@tsp-tidb-taos-01 ~]# mysql -h 127.0.0.1 -P 4000 -u root -p
Enter password:
MySQL [(none)]> create database sbtest;
初始化压测数据建100张表
[root@taos3 sysbench]#sysbench oltp_common --threads=32 --rand-type=uniform  --db-driver=mysql --mysql-db=sbtest --mysql-host=172.16.0.165 --mysql-port=4000 --mysql-user=root --mysql-password='xz291uc@^3iU57+B_k'  --tables=100 --table-size=10 prepare
写入测试
线程数:512 表大小:1000w表数量:16测试时长:5分钟
[root@taos3 sysbench]# sysbench oltp_write_only    --threads=512     --rand-type=uniform  --db-driver=mysql     --mysql-db=sbtest     --mysql-host=172.16.0.165  --mysql-port=4000     --mysql-user=root     --mysql-password='xz291uc@^3iU57+B_k'      --tables=16 --table-size=10000000 --report-interval=10 --time=300 run

线程数:1024表大小:1000w表数量:16测试时长:5分钟
[root@taos3 sysbench]# sysbench oltp_write_only    --threads=1024     --rand-type=uniform     --db-driver=mysql     --mysql-db=sbtest     --mysql-host=172.16.0.165    --mysql-port=4000     --mysql-user=root     --mysql-password='xz291uc@^3iU57+B_k'      --tables=16 --table-size=10000000 --report-interval=10 --time=300 run

线程数:1280表大小:1000w表数量:16测试时长:5分钟
[root@taos3 sysbench]# sysbench oltp_write_only    --threads=1280     --rand-type=uniform     --db-driver=mysql     --mysql-db=sbtest     --mysql-host=172.16.0.165    --mysql-port=4000     --mysql-user=root     --mysql-password='xz291uc@^3iU57+B_k'      --tables=16 --table-size=10000000 --report-interval=10 --time=300 run

压测结果
同一个数据库系统不同线程对数据库插入读取的影响
1000左右并发时TPS、QPS最高
| Threads | TPS | QPS | 
| 512 | 12198 | 73190 | 
| 1024 | 13829 | 82974 | 
| 1280 | 13423 | 80543 | 
--------------------------分割线------
3、TIDB版本:6.5.3
压测步骤
Sysbench 测试准备
升级数据库版本到6.5.3

写入测试
线程数:512 表大小:1000w表数量:16测试时长:5分钟
[root@taos3 sysbench]# sysbench oltp_write_only    --threads=512     --rand-type=uniform  --db-driver=mysql     --mysql-db=sbtest     --mysql-host=172.16.0.165  --mysql-port=4000     --mysql-user=root     --mysql-password='xz291uc@^3iU57+B_k'      --tables=16 --table-size=10000000 --report-interval=10 --time=300 run

线程数:1024表大小:1000w表数量:16测试时长:5分钟
[root@taos3 sysbench]# sysbench oltp_write_only    --threads=1024     --rand-type=uniform     --db-driver=mysql     --mysql-db=sbtest     --mysql-host=172.16.0.165    --mysql-port=4000     --mysql-user=root     --mysql-password='xz291uc@^3iU57+B_k'      --tables=16 --table-size=10000000 --report-interval=10 --time=300 run

线程数:1280表大小:1000w表数量:16测试时长:5分钟
[root@taos3 sysbench]# sysbench oltp_write_only    --threads=1280     --rand-type=uniform     --db-driver=mysql     --mysql-db=sbtest     --mysql-host=172.16.0.165    --mysql-port=4000     --mysql-user=root     --mysql-password='xz291uc@^3iU57+B_k'      --tables=16 --table-size=10000000 --report-interval=10 --time=300 run

压测结果
同一个数据库系统不同线程对数据库插入读取的影响
1000左右并发时TPS、QPS最高
| Threads | TPS | QPS | 
| 512 | 14394 | 86368 | 
| 1024 | 14969 | 89818 | 
| 1280 | 14044 | 84264 | 
----------------
2个数据库版本测试结果对比
| 版本 | Threads | TPS | QPS | 
| 5.4.3 | 512 | 12198 | 73190 | 
| 1024 | 13829 | 82974 | |
| 1280 | 13423 | 80543 | |
| 6.5.3 | 512 | 14394 | 86368 | 
| 1024 | 14969 | 89818 | |
| 1280 | 14044 | 84264 | 

