sysbench测试TiDB数据库

本文详细介绍了如何在TiDB环境中使用Sysbench进行性能测试,包括软件下载、依赖安装、配置文件准备以及OLTP操作(插入、更新、查询)的步骤,以及遇到的常见问题解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

**

TiDB性能测试

**

建议使用 Sysbench 1.0 或之后的更新版本

软件下载地址

https://github.com/akopytov/sysbench
https://github.com/akopytov/sysbench/archive/1.0.20.tar.gz

安装依赖包

yum -y install gcc gcc-c++ automake make libtool pkgconfig libaio-devel openssl-devel

上传服务器并解压并编译安装sysbench,依次执行如下命令:

tar -zxvf 1.0.16.tar.gz

cd sysbench-1.0.16

./autogen.sh

./configure --with-mysql-includes=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql --with-mysql

make -j 2 && make install

踩坑一:
执行./configure --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/bin/ 时报错:
cannot find MySQL client libraries
在这里插入图片描述
解决方案:缺少mysql-devel这个库,执行:yum install mysql-devel
安装完成后再次执行…/configure --with-mysql-includes=/usr/local/mysql/include/ ,成功

准备配置文件:tidb-config
mysql-host=10.168.2.xx
mysql-port=4000
mysql-user=root
mysql-password=xxxxxx
mysql-db=test
db-driver=mysql

sysbench安装目录,里面包含了很多脚本:/usr/local/share/sysbench

测试执行

导入数据:
sysbench --config-file=tidb-config oltp_point_select --tables=32 --table-size=10000000 prepare

测试数据准备(实际是创建的表):
sysbench /usr/local/share/sysbench/bulk_insert.lua --config-file=tidb-config --tables=50 --threads=100 --table_size=20000000 --report-interval=10 prepare

批量插入数据(是插入表的数据):
sysbench /usr/local/share/sysbench/oltp_insert.lua --config-file=tidb-config --tables=50 --threads=50 --table_size=2000000 --report-interval=10 run
更新数据:
sysbench /usr/local/share/sysbench/bulk_insert.lua --config-file=tidb-config --tables=50 --threads=50 --table_size=30000000 --report-interval=10 run

查询数据:
sysbench /usr/local/share/sysbench/oltp_read_only.lua --config-file=tidb-config --tables=50 --threads=50 --table_size=30000000 --report-interval=10 run

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值