sysbench压力测试工具安装及使用

时间:2023-03-09 16:27:54
sysbench压力测试工具安装及使用

使用sysbench指定连接的时候不需要写上mysql-socket参数

如果自己使用sysbench来测试mysql性能的话,建议使用源码编译比较好,版本为0.4版本。

步骤是:

1、yum install m4 autoconf automake libtool
2、./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include/ --with-mysql-libs=/usr/local/mysql/lib/
3、make
4、make install

但是如果是测试tidb性能的,因为tidb官方推荐脚本,所以选择yum安装的sysbench比较好,这时安装的sysbench是1.0版本的。

tidb的官方脚本:https://github.com/pingcap/tidb-bench/tree/cwen/not_prepared_statement/sysbench

直接在tidb提供的conf.sh文件里面把配置写好,然后就可以执行那些需要的脚本了(比如prepare.sh、select.sh)

在AWS自己定制的实例上面,使用yum安装sysbench1.0是不行的,原因是没有yum源。所以警告一番折腾之后有了下面这个

curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
sudo yum -y install sysbench

这个时候就可以安装sysbench1.0了。

sysbench压力测试结果说明

Threads started!

OLTP test statistics:
queries performed:
read: 179470-- 读总数
write: 453935-- 写总数
other: 70678-- 其他操作总数(SELECT、INSERT、UPDATE、DELETE之外的操作,例如COMMIT等)
total: 704083 -- 全部总数
transactions事务量: 34784 (347.32 per sec.)-- 总事务数(每秒事务数)
queries 读写总操作: 633405 (6324.57 per sec.) -- 读写总数(每秒读写次数)
other operations其他操作: 70678 (705.72 per sec.)-- 其他操作总数(每秒其他操作次数)
ignored errors: 1110 (11.08 per sec.)-- 每秒忽略的错误
reconnects: 0 (0.00 per sec.)--每秒重连次数 General statistics:
total time(总时长): 100.1499s -- 总耗时
total number of events: 34784 -- 共发生多少事务数
total time taken by events execution: 1996.2507s -- 所有事务耗时相加(不考虑并行因素)
response time(相应时间):
min最小: 2.54ms-- 最小耗时
avg平均: 57.39ms-- 平均耗时
max最大: 1074.85ms -- 最长耗时
95th percentile: 133.50ms-- 超过99%平均耗时 Threads fairness:
events (avg/stddev): 1739.2000/35.03
execution time (avg/stddev): 99.8125/0.05