sysbench是一款开源的多线程性能测试工具,可以执行CPU/内存/线程/IO/数据库等方面的性能测试。数据库目前支持MySQL/Oracle/PostgreSQL;在本次试验中,sysbench版本为:1.0.20。
# 加压并编译sysbench
....
# 测试准备,需进入mysql创建测试所需库
mysql -uroot -proot -h172.30.28.24 -P3306
create database sbtest;
# 进行测试
cd sysbench/tests/include/oltp_legacy
# 测试数据
sysbench oltp.lua --mysql-host=172.30.28.24 --mysql-port=3306 --mysql-user=root --mysql-password=root --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=20 --time=120 --report-interval=10 prepare
# 运行测试
sysbench oltp.lua --mysql-host=172.30.28.24 --mysql-port=3306 --mysql-user=root --mysql-password=root --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=4 --time=120 --report-interval=10 run
#清理测试数据
sysbench oltp.lua --mysql-host=172.30.28.24 --mysql-port=3306 --mysql-user=root --mysql-password=root cleanup
# 查看数据
queries:查询总数及qps
transactions:事务总数及tps
Latency-95th percentile:前95%的请求的最大响应时间