mysql案例-sysbench安装测试

一 地址 
githup地址
https://github.com/akopytov/sysbench
二 版本 sysbench 1.0.15

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

三 实验是否可运行

   sh /test/test_run.sh 会运行检测,通过就代表能成功

四  两种测试方式
1 加载lua脚本
   1 自定义lua脚本
   2 自带lua脚本

  一般路径为 /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua

2 采用模块测试

五 测试样例

1 sysbench ./src/lua/oltp_read_write.lua --table_size=10000 --tables=10 --rand-spec-res=75 --threads=128 --time=3600 --warmup-time=100 --report-interval=3 --point_selects=4 --non_index_updates=1 --delete_inserts=1 --index_updates=1 --simple_ranges=0 --order_ranges=0 --range_selects=off  --mysql-user=test --mysql-host=IP ==mysql-password=test 

2 sysbench --test=/usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-table-engine=innodb --oltp-table-size=100000000 --oltp-tables-count=20 --mysql-db=DB --mysql-user=USER --mysql-host=IP --mysql-password=1111 prepare

3 sysbench --test=/usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-table-engine=innodb --mysql-db=  --mysql-user=  --mysql-host=  --mysql-password=  --mysql-table-engine=innodb --num_threads=10 --oltp-table-size=10000000 --oltp-tables-count=10 --max-requests=1000 --report-interval=5 --percentile=99 --max-time=3600 run

六 相关参数说明

mysql-table-engine 引擎规定 一般为innodb

oltp-table-size        表行数 

oltp-table-count     表的个数

mysql-db               指定库

mysql-user            指定用户

mysql-host           指定IP

prepare/run/clean               插入数据/进行测试/清除数据

max-requests   最大请求数

num_threads   并发线程数

report-interval  间隔秒数报告

percentile  最大有效数据占用比

max-time  最长时间

七  结果讲解

QL statistics:
queries performed:
read: 2800000                                        // read
write: 800000                                        //  update、insert、delete语句数量
other: 400000                                       //  其他
total: 4000000                                     //   总量
transactions: 200000 (1412.99 per sec.) // 总事务数 | 每秒事务数
queries: 4000000 (28259.81 per sec.) //总查询数 | 每秒查询数
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)

General statistics:
total time: 141.5415s        //总耗时
total number of events: 200000 //总事务数 

Latency (ms):   //延迟
min: 6.10
avg: 141.47
max: 2139.58
99th percentile: 943.16
sum: 28294574.56

 七 数据展示

  将数据汇总到execl中国,execl本身有制图功能可以展示

原文地址:https://www.cnblogs.com/danhuangpai/p/8277339.html