sysbench是一款开源的多线程性能测试工具,可以执行CPU/内存/线程/IO/数据库等方面的性能测试。
更重要的我们是用来做OLTP的测试
http://imysql.com/2014/10/17/sysbench-full-user-manual.shtml
下载地址:http://imysql.com/wp-content/uploads/2014/09/sysbench-0.4.12-1.1.tgz
sysbench-0.4.12-1.1.tgz
tar -zxvf sysbench-0.4.12-1.1.tgz
cd sysbench-0.4.12-1.1
sysbench支持以下几种测试模式:
1、CPU运算性能
2、磁盘IO性能
3、调度程序性能
4、内存分配及传输速度
5、POSIX线程性能
6、数据库性能(OLTP基准测试)
目前sysbench主要支持 mysql,drizzle,pgsql,oracle 等几种数据库。
二、编译安装
前提是安装了编译环境:
包括gcc libtool openssl openssl-devel
编译非常简单,可参考 README 文档,简单步骤如下:
https://github.com/akopytov/sysbench/releases/tag/1.0.9
[root@mysqlcentos01 sysbench-1.0.9]# ./autogen.sh
[root@mysqlcentos01 sysbench-1.0.9]# ./configure --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib --with-mysql
[root@mysqlcentos01 sysbench-1.0.9]# make
[root@mysqlcentos01 sysbench-1.0.9]# make install
环境变量:
安装完成之后会在目录下生产sysbench命令
直接cp到
[root@mysqlcentos01 sysbench-1.0.9]# pwd
/opt/sysbench-1.0.9
[root@mysqlcentos01 sysbench-1.0.9]# cp sysbench /usr/local/bin/sysbench
sysbench报错:
[root@mysqlcentos01 include]# sysbench --help
sysbench: error while loading shared libraries: libmysqlclient.so
.20: cannot open shared object file: No such file or directory
ln -s /opt/mysql/mysql-5.7.18-linux-glibc2.5-x86_64/lib/libmysqlclient.so /usr/lib64/libmysqlclient.so.20
[root@centos03mm test]# sysbench --threads=10 --max-time=300 threads run
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[root@centos03mm test]#
解决方法:
vi /etc/profile
export LD_LIBRARY_PATH=/usr/local/mysql/lib
source /etc/profile
测试cpu
[root@mysqlcentos01 sysbench-1.0.9]# sysbench --test=cpu --num-threads=4 --max-time=10 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --num-threads is deprecated, use --threads instead
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.9 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 888.00
General statistics:
total time: 10.0020s
total number of events: 8883
Latency (ms):
min: 1.00
avg: 4.49
max: 304.61
95th percentile: 33.12
sum: 39893.75
Threads fairness:
events (avg/stddev): 2220.7500/35.22
execution time (avg/stddev): 9.9734/0.03
[root@mysqlcentos01 sysbench-1.0.9]#
根据以上提示修改为:
[root@mysqlcentos01 opt]# sysbench cpu --threads=4 --time=10 run
sysbench 1.0.9 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 930.90
General statistics:
total time: 10.0008s
total number of events: 9311
Latency (ms):
min: 1.00
avg: 4.28
max: 64.02
95th percentile: 33.12
sum: 39882.94
Threads fairness:
events (avg/stddev): 2327.7500/5.89
execution time (avg/stddev): 9.9707/0.02
[root@mysqlcentos01 opt]#
OLTP测试:
先生成一份测试数据
[root@mysqlcentos01 opt]# sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-sock=/tmp/mysql3306.sock --mysql-user=root --mysql-password=evis123 /opt/sysbench-1.0.9/tests/include/oltp_legacy/oltp.lua --oltp_tables_count=10 --oltp-table-size=100000 --rand-init=on prepare
sysbench 1.0.9 (using bundled LuaJIT 2.1.0-beta2)
Creating table 'sbtest1'...
Inserting 100000 records into 'sbtest1'
Creating secondary indexes on 'sbtest1'...
Creating table 'sbtest2'...
Inserting 100000 records into 'sbtest2'
Creating secondary indexes on 'sbtest2'...
Creating table 'sbtest3'...
Inserting 100000 records into 'sbtest3'
Creating secondary indexes on 'sbtest3'...
Creating table 'sbtest4'...
Inserting 100000 records into 'sbtest4'
Creating secondary indexes on 'sbtest4'...
Creating table 'sbtest5'...
Inserting 100000 records into 'sbtest5'
Creating secondary indexes on 'sbtest5'...
Creating table 'sbtest6'...
Inserting 100000 records into 'sbtest6'
Creating secondary indexes on 'sbtest6'...
Creating table 'sbtest7'...
Inserting 100000 records into 'sbtest7'
Creating secondary indexes on 'sbtest7'...
Creating table 'sbtest8'...
Inserting 100000 records into 'sbtest8'
Creating secondary indexes on 'sbtest8'...
Creating table 'sbtest9'...
Inserting 100000 records into 'sbtest9'
Creating secondary indexes on 'sbtest9'...
Creating table 'sbtest10'...
Inserting 100000 records into 'sbtest10'
Creating secondary indexes on 'sbtest10'...
[root@mysqlcentos01 opt]#
开始测试:
[root@mysqlcentos01 opt]# sysbench --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=evis123 /opt/sysbench-1.0.9/tests/include/oltp_legacy/oltp.lua --mysql-table-engine=innodb --oltp_tables_count=10 --oltp-table-size=100000 --num-threads=2 --oltp-read-only=off --report-interval=10 --rand-type=uniform --max-time=1800 --max-requests=0 --percentile=99 run >> sysbench_insert_200_20170930.log
[root@mysqlcentos01 opt]#
[root@mysqlcentos01 opt]#
测试结果:
[root@mysqlcentos01 opt]# cat sysbench_insert_200_20170930.log
WARNING: --num-threads is deprecated, use --threads instead
WARNING: --max-time is deprecated, use --time instead
sysbench 1.0.9 (using bundled LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 2
Report intermediate results every 10 second(s)
Initializing random number generator from current time
Initializing worker threads...
Threads started!
[ 10s ] thds: 2 tps: 6.00 qps: 121.47 (r/w/o: 85.28/23.99/12.20) lat (ms,99%): 719.92 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 2 tps: 5.70 qps: 115.20 (r/w/o: 81.00/22.80/11.40) lat (ms,99%): 623.33 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 2 tps: 6.40 qps: 128.30 (r/w/o: 89.90/25.60/12.80) lat (ms,99%): 1032.01 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 2 tps: 7.00 qps: 138.70 (r/w/o: 96.70/28.00/14.00) lat (ms,99%): 909.80 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 2 tps: 6.90 qps: 138.00 (r/w/o: 96.60/27.60/13.80) lat (ms,99%): 846.57 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 2 tps: 4.60 qps: 92.60 (r/w/o: 65.00/18.40/9.20) lat (ms,99%): 846.57 err/s: 0.00 reconn/s: 0.00
[ 70s ] thds: 2 tps: 5.10 qps: 101.50 (r/w/o: 70.80/20.50/10.20) lat (ms,99%): 1427.08 err/s: 0.00 reconn/s: 0.00
[ 80s ] thds: 2 tps: 6.30 qps: 126.81 (r/w/o: 89.10/25.10/12.60) lat (ms,99%): 759.88 err/s: 0.00 reconn/s: 0.00
[ 90s ] thds: 2 tps: 5.60 qps: 111.68 (r/w/o: 78.08/22.40/11.20) lat (ms,99%): 1191.92 err/s: 0.00 reconn/s: 0.00
[ 100s ] thds: 2 tps: 6.00 qps: 120.72 (r/w/o: 84.61/24.10/12.00) lat (ms,99%): 1149.76 err/s: 0.00 reconn/s: 0.00
[ 110s ] thds: 2 tps: 7.00 qps: 139.41 (r/w/o: 97.50/27.90/14.00) lat (ms,99%): 846.57 err/s: 0.00 reconn/s: 0.00
[ 120s ] thds: 2 tps: 4.60 qps: 92.29 (r/w/o: 64.69/18.40/9.20) lat (ms,99%): 1427.08 err/s: 0.00 reconn/s: 0.00
[ 130s ] thds: 2 tps: 6.40 qps: 128.01 (r/w/o: 89.50/25.70/12.80) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 140s ] thds: 2 tps: 6.20 qps: 124.21 (r/w/o: 87.01/24.80/12.40) lat (ms,99%): 1069.86 err/s: 0.00 reconn/s: 0.00
[ 150s ] thds: 2 tps: 6.10 qps: 120.70 (r/w/o: 84.20/24.30/12.20) lat (ms,99%): 1013.60 err/s: 0.00 reconn/s: 0.00
[ 160s ] thds: 2 tps: 6.20 qps: 124.49 (r/w/o: 87.29/24.80/12.40) lat (ms,99%): 926.33 err/s: 0.00 reconn/s: 0.00
[ 170s ] thds: 2 tps: 6.60 qps: 132.41 (r/w/o: 92.80/26.40/13.20) lat (ms,99%): 1050.76 err/s: 0.00 reconn/s: 0.00
[ 180s ] thds: 2 tps: 6.40 qps: 128.70 (r/w/o: 90.10/25.80/12.80) lat (ms,99%): 682.06 err/s: 0.00 reconn/s: 0.00
[ 190s ] thds: 2 tps: 6.70 qps: 131.80 (r/w/o: 91.80/26.60/13.40) lat (ms,99%): 995.51 err/s: 0.00 reconn/s: 0.00
[ 200s ] thds: 2 tps: 6.20 qps: 126.10 (r/w/o: 88.80/24.90/12.40) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 210s ] thds: 2 tps: 7.20 qps: 142.09 (r/w/o: 99.00/28.70/14.40) lat (ms,99%): 694.45 err/s: 0.00 reconn/s: 0.00
[ 220s ] thds: 2 tps: 7.20 qps: 145.99 (r/w/o: 102.60/29.00/14.40) lat (ms,99%): 657.93 err/s: 0.00 reconn/s: 0.00
[ 230s ] thds: 2 tps: 6.10 qps: 121.50 (r/w/o: 85.00/24.30/12.20) lat (ms,99%): 1109.09 err/s: 0.00 reconn/s: 0.00
[ 240s ] thds: 2 tps: 7.60 qps: 150.61 (r/w/o: 105.10/30.30/15.20) lat (ms,99%): 580.02 err/s: 0.00 reconn/s: 0.00
[ 250s ] thds: 2 tps: 7.30 qps: 147.11 (r/w/o: 103.30/29.20/14.60) lat (ms,99%): 475.79 err/s: 0.00 reconn/s: 0.00
[ 260s ] thds: 2 tps: 6.00 qps: 120.29 (r/w/o: 84.30/24.00/12.00) lat (ms,99%): 831.46 err/s: 0.00 reconn/s: 0.00
[ 270s ] thds: 2 tps: 6.30 qps: 125.89 (r/w/o: 88.09/25.20/12.60) lat (ms,99%): 1327.91 err/s: 0.00 reconn/s: 0.00
[ 280s ] thds: 2 tps: 8.20 qps: 162.71 (r/w/o: 113.51/32.80/16.40) lat (ms,99%): 520.62 err/s: 0.00 reconn/s: 0.00
[ 290s ] thds: 2 tps: 7.50 qps: 151.10 (r/w/o: 106.10/30.00/15.00) lat (ms,99%): 530.08 err/s: 0.00 reconn/s: 0.00
[ 300s ] thds: 2 tps: 7.20 qps: 143.90 (r/w/o: 100.70/28.80/14.40) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 310s ] thds: 2 tps: 6.90 qps: 138.81 (r/w/o: 97.30/27.70/13.80) lat (ms,99%): 893.56 err/s: 0.00 reconn/s: 0.00
[ 320s ] thds: 2 tps: 6.70 qps: 132.50 (r/w/o: 92.40/26.70/13.40) lat (ms,99%): 746.32 err/s: 0.00 reconn/s: 0.00
[ 330s ] thds: 2 tps: 5.60 qps: 112.80 (r/w/o: 79.20/22.40/11.20) lat (ms,99%): 846.57 err/s: 0.00 reconn/s: 0.00
[ 340s ] thds: 2 tps: 6.40 qps: 127.40 (r/w/o: 88.90/25.70/12.80) lat (ms,99%): 733.00 err/s: 0.00 reconn/s: 0.00
[ 350s ] thds: 2 tps: 7.20 qps: 144.50 (r/w/o: 101.40/28.70/14.40) lat (ms,99%): 926.33 err/s: 0.00 reconn/s: 0.00
[ 360s ] thds: 2 tps: 7.00 qps: 140.09 (r/w/o: 98.10/28.00/14.00) lat (ms,99%): 569.67 err/s: 0.00 reconn/s: 0.00
[ 370s ] thds: 2 tps: 6.30 qps: 125.41 (r/w/o: 87.60/25.20/12.60) lat (ms,99%): 682.06 err/s: 0.00 reconn/s: 0.00
[ 380s ] thds: 2 tps: 2.30 qps: 44.60 (r/w/o: 30.80/9.20/4.60) lat (ms,99%): 2362.72 err/s: 0.00 reconn/s: 0.00
[ 390s ] thds: 2 tps: 4.10 qps: 84.40 (r/w/o: 59.80/16.40/8.20) lat (ms,99%): 1304.21 err/s: 0.00 reconn/s: 0.00
[ 400s ] thds: 2 tps: 4.20 qps: 83.30 (r/w/o: 58.10/16.80/8.40) lat (ms,99%): 1352.03 err/s: 0.00 reconn/s: 0.00
[ 410s ] thds: 2 tps: 3.80 qps: 74.60 (r/w/o: 51.80/15.20/7.60) lat (ms,99%): 1213.57 err/s: 0.00 reconn/s: 0.00
[ 420s ] thds: 2 tps: 6.40 qps: 129.80 (r/w/o: 91.40/25.60/12.80) lat (ms,99%): 995.51 err/s: 0.00 reconn/s: 0.00
[ 430s ] thds: 2 tps: 5.90 qps: 118.60 (r/w/o: 83.10/23.70/11.80) lat (ms,99%): 995.51 err/s: 0.00 reconn/s: 0.00
[ 440s ] thds: 2 tps: 7.50 qps: 149.80 (r/w/o: 104.80/30.00/15.00) lat (ms,99%): 493.24 err/s: 0.00 reconn/s: 0.00
[ 450s ] thds: 2 tps: 8.20 qps: 163.60 (r/w/o: 114.50/32.70/16.40) lat (ms,99%): 467.30 err/s: 0.00 reconn/s: 0.00
[ 460s ] thds: 2 tps: 6.60 qps: 131.10 (r/w/o: 91.50/26.40/13.20) lat (ms,99%): 893.56 err/s: 0.00 reconn/s: 0.00
[ 470s ] thds: 2 tps: 7.30 qps: 146.19 (r/w/o: 102.40/29.20/14.60) lat (ms,99%): 682.06 err/s: 0.00 reconn/s: 0.00
[ 480s ] thds: 2 tps: 7.40 qps: 148.10 (r/w/o: 103.70/29.60/14.80) lat (ms,99%): 802.05 err/s: 0.00 reconn/s: 0.00
[ 490s ] thds: 2 tps: 7.40 qps: 148.40 (r/w/o: 103.90/29.70/14.80) lat (ms,99%): 502.20 err/s: 0.00 reconn/s: 0.00
[ 500s ] thds: 2 tps: 6.20 qps: 123.80 (r/w/o: 86.70/24.70/12.40) lat (ms,99%): 960.30 err/s: 0.00 reconn/s: 0.00
[ 510s ] thds: 2 tps: 7.10 qps: 142.30 (r/w/o: 99.70/28.40/14.20) lat (ms,99%): 746.32 err/s: 0.00 reconn/s: 0.00
[ 520s ] thds: 2 tps: 8.20 qps: 162.40 (r/w/o: 113.20/32.80/16.40) lat (ms,99%): 719.92 err/s: 0.00 reconn/s: 0.00
[ 530s ] thds: 2 tps: 7.20 qps: 144.60 (r/w/o: 101.40/28.80/14.40) lat (ms,99%): 802.05 err/s: 0.00 reconn/s: 0.00
[ 540s ] thds: 2 tps: 7.20 qps: 144.51 (r/w/o: 101.30/28.80/14.40) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 550s ] thds: 2 tps: 7.10 qps: 141.70 (r/w/o: 99.10/28.40/14.20) lat (ms,99%): 1213.57 err/s: 0.00 reconn/s: 0.00
[ 560s ] thds: 2 tps: 6.60 qps: 131.89 (r/w/o: 92.30/26.40/13.20) lat (ms,99%): 831.46 err/s: 0.00 reconn/s: 0.00
[ 570s ] thds: 2 tps: 6.70 qps: 133.60 (r/w/o: 93.40/26.80/13.40) lat (ms,99%): 646.19 err/s: 0.00 reconn/s: 0.00
[ 580s ] thds: 2 tps: 3.70 qps: 74.20 (r/w/o: 52.00/14.80/7.40) lat (ms,99%): 2082.91 err/s: 0.00 reconn/s: 0.00
[ 590s ] thds: 2 tps: 3.60 qps: 73.00 (r/w/o: 51.40/14.40/7.20) lat (ms,99%): 2985.89 err/s: 0.00 reconn/s: 0.00
[ 600s ] thds: 2 tps: 7.30 qps: 144.70 (r/w/o: 100.90/29.20/14.60) lat (ms,99%): 520.62 err/s: 0.00 reconn/s: 0.00
[ 610s ] thds: 2 tps: 7.40 qps: 147.50 (r/w/o: 103.10/29.60/14.80) lat (ms,99%): 493.24 err/s: 0.00 reconn/s: 0.00
[ 620s ] thds: 2 tps: 3.50 qps: 71.30 (r/w/o: 50.30/14.00/7.00) lat (ms,99%): 2198.52 err/s: 0.00 reconn/s: 0.00
[ 630s ] thds: 2 tps: 8.10 qps: 162.00 (r/w/o: 113.40/32.40/16.20) lat (ms,99%): 502.20 err/s: 0.00 reconn/s: 0.00
[ 640s ] thds: 2 tps: 7.00 qps: 140.40 (r/w/o: 98.40/28.00/14.00) lat (ms,99%): 909.80 err/s: 0.00 reconn/s: 0.00
[ 650s ] thds: 2 tps: 6.10 qps: 122.10 (r/w/o: 85.50/24.40/12.20) lat (ms,99%): 909.80 err/s: 0.00 reconn/s: 0.00
[ 660s ] thds: 2 tps: 7.40 qps: 147.37 (r/w/o: 102.98/29.59/14.80) lat (ms,99%): 943.16 err/s: 0.00 reconn/s: 0.00
[ 670s ] thds: 2 tps: 6.60 qps: 131.73 (r/w/o: 92.12/26.41/13.20) lat (ms,99%): 612.21 err/s: 0.00 reconn/s: 0.00
[ 680s ] thds: 2 tps: 7.40 qps: 148.69 (r/w/o: 104.29/29.60/14.80) lat (ms,99%): 590.56 err/s: 0.00 reconn/s: 0.00
[ 690s ] thds: 2 tps: 7.90 qps: 157.41 (r/w/o: 110.00/31.60/15.80) lat (ms,99%): 493.24 err/s: 0.00 reconn/s: 0.00
[ 700s ] thds: 2 tps: 6.80 qps: 136.80 (r/w/o: 96.00/27.20/13.60) lat (ms,99%): 861.95 err/s: 0.00 reconn/s: 0.00
[ 710s ] thds: 2 tps: 8.20 qps: 164.51 (r/w/o: 115.20/32.90/16.40) lat (ms,99%): 493.24 err/s: 0.00 reconn/s: 0.00
[ 720s ] thds: 2 tps: 7.40 qps: 146.80 (r/w/o: 102.50/29.50/14.80) lat (ms,99%): 580.02 err/s: 0.00 reconn/s: 0.00
[ 730s ] thds: 2 tps: 6.70 qps: 132.90 (r/w/o: 92.70/26.80/13.40) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 740s ] thds: 2 tps: 5.90 qps: 119.30 (r/w/o: 83.90/23.60/11.80) lat (ms,99%): 816.63 err/s: 0.00 reconn/s: 0.00
[ 750s ] thds: 2 tps: 7.10 qps: 142.40 (r/w/o: 99.80/28.40/14.20) lat (ms,99%): 816.63 err/s: 0.00 reconn/s: 0.00
[ 760s ] thds: 2 tps: 7.90 qps: 157.60 (r/w/o: 110.20/31.60/15.80) lat (ms,99%): 520.62 err/s: 0.00 reconn/s: 0.00
[ 770s ] thds: 2 tps: 6.30 qps: 125.80 (r/w/o: 88.00/25.20/12.60) lat (ms,99%): 816.63 err/s: 0.00 reconn/s: 0.00
[ 780s ] thds: 2 tps: 6.30 qps: 126.69 (r/w/o: 88.89/25.20/12.60) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 790s ] thds: 2 tps: 6.80 qps: 135.10 (r/w/o: 94.30/27.20/13.60) lat (ms,99%): 634.66 err/s: 0.00 reconn/s: 0.00
[ 800s ] thds: 2 tps: 7.00 qps: 140.41 (r/w/o: 98.40/28.00/14.00) lat (ms,99%): 559.50 err/s: 0.00 reconn/s: 0.00
[ 810s ] thds: 2 tps: 6.50 qps: 129.29 (r/w/o: 90.30/26.00/13.00) lat (ms,99%): 773.68 err/s: 0.00 reconn/s: 0.00
[ 820s ] thds: 2 tps: 7.10 qps: 142.90 (r/w/o: 100.10/28.60/14.20) lat (ms,99%): 943.16 err/s: 0.00 reconn/s: 0.00
[ 830s ] thds: 2 tps: 6.30 qps: 126.90 (r/w/o: 89.20/25.10/12.60) lat (ms,99%): 601.29 err/s: 0.00 reconn/s: 0.00
[ 840s ] thds: 2 tps: 5.20 qps: 102.40 (r/w/o: 71.30/20.70/10.40) lat (ms,99%): 1013.60 err/s: 0.00 reconn/s: 0.00
[ 850s ] thds: 2 tps: 4.90 qps: 98.50 (r/w/o: 69.10/19.60/9.80) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 860s ] thds: 2 tps: 7.20 qps: 143.40 (r/w/o: 100.20/28.80/14.40) lat (ms,99%): 1280.93 err/s: 0.00 reconn/s: 0.00
[ 870s ] thds: 2 tps: 5.40 qps: 108.69 (r/w/o: 76.30/21.60/10.80) lat (ms,99%): 816.63 err/s: 0.00 reconn/s: 0.00
[ 880s ] thds: 2 tps: 7.80 qps: 157.01 (r/w/o: 110.11/31.30/15.60) lat (ms,99%): 539.71 err/s: 0.00 reconn/s: 0.00
[ 890s ] thds: 2 tps: 6.50 qps: 128.10 (r/w/o: 89.20/25.90/13.00) lat (ms,99%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 900s ] thds: 2 tps: 7.00 qps: 141.20 (r/w/o: 99.20/28.00/14.00) lat (ms,99%): 926.33 err/s: 0.00 reconn/s: 0.00
[ 910s ] thds: 2 tps: 7.10 qps: 142.39 (r/w/o: 99.80/28.40/14.20) lat (ms,99%): 580.02 err/s: 0.00 reconn/s: 0.00
[ 920s ] thds: 2 tps: 7.30 qps: 145.50 (r/w/o: 101.40/29.50/14.60) lat (ms,99%): 682.06 err/s: 0.00 reconn/s: 0.00
[ 930s ] thds: 2 tps: 6.00 qps: 118.51 (r/w/o: 82.80/23.70/12.00) lat (ms,99%): 1050.76 err/s: 0.00 reconn/s: 0.00
[ 940s ] thds: 2 tps: 7.70 qps: 154.90 (r/w/o: 108.70/30.80/15.40) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 950s ] thds: 2 tps: 6.70 qps: 134.20 (r/w/o: 94.00/26.80/13.40) lat (ms,99%): 646.19 err/s: 0.00 reconn/s: 0.00
[ 960s ] thds: 2 tps: 7.50 qps: 149.01 (r/w/o: 104.00/30.00/15.00) lat (ms,99%): 520.62 err/s: 0.00 reconn/s: 0.00
[ 970s ] thds: 2 tps: 7.50 qps: 150.99 (r/w/o: 106.00/30.00/15.00) lat (ms,99%): 1170.65 err/s: 0.00 reconn/s: 0.00
[ 980s ] thds: 2 tps: 6.50 qps: 131.10 (r/w/o: 91.90/26.20/13.00) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 990s ] thds: 2 tps: 6.60 qps: 131.40 (r/w/o: 92.00/26.20/13.20) lat (ms,99%): 846.57 err/s: 0.00 reconn/s: 0.00
[ 1000s ] thds: 2 tps: 7.00 qps: 139.80 (r/w/o: 97.80/28.00/14.00) lat (ms,99%): 759.88 err/s: 0.00 reconn/s: 0.00
[ 1010s ] thds: 2 tps: 5.50 qps: 109.90 (r/w/o: 76.90/22.00/11.00) lat (ms,99%): 1771.29 err/s: 0.00 reconn/s: 0.00
[ 1020s ] thds: 2 tps: 4.70 qps: 94.10 (r/w/o: 65.90/18.80/9.40) lat (ms,99%): 2405.65 err/s: 0.00 reconn/s: 0.00
[ 1030s ] thds: 2 tps: 7.90 qps: 157.81 (r/w/o: 110.40/31.60/15.80) lat (ms,99%): 569.67 err/s: 0.00 reconn/s: 0.00
[ 1040s ] thds: 2 tps: 8.10 qps: 163.50 (r/w/o: 114.50/32.80/16.20) lat (ms,99%): 634.66 err/s: 0.00 reconn/s: 0.00
[ 1050s ] thds: 2 tps: 6.20 qps: 123.20 (r/w/o: 86.40/24.40/12.40) lat (ms,99%): 960.30 err/s: 0.00 reconn/s: 0.00
[ 1060s ] thds: 2 tps: 6.30 qps: 126.30 (r/w/o: 88.30/25.40/12.60) lat (ms,99%): 1191.92 err/s: 0.00 reconn/s: 0.00
[ 1070s ] thds: 2 tps: 8.20 qps: 162.40 (r/w/o: 113.40/32.60/16.40) lat (ms,99%): 502.20 err/s: 0.00 reconn/s: 0.00
[ 1080s ] thds: 2 tps: 7.50 qps: 151.20 (r/w/o: 106.00/30.20/15.00) lat (ms,99%): 569.67 err/s: 0.00 reconn/s: 0.00
[ 1090s ] thds: 2 tps: 6.20 qps: 122.50 (r/w/o: 85.50/24.60/12.40) lat (ms,99%): 1032.01 err/s: 0.00 reconn/s: 0.00
[ 1100s ] thds: 2 tps: 6.60 qps: 131.90 (r/w/o: 92.30/26.40/13.20) lat (ms,99%): 943.16 err/s: 0.00 reconn/s: 0.00
[ 1110s ] thds: 2 tps: 7.20 qps: 144.89 (r/w/o: 101.70/28.80/14.40) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 1120s ] thds: 2 tps: 7.70 qps: 154.11 (r/w/o: 107.90/30.80/15.40) lat (ms,99%): 511.33 err/s: 0.00 reconn/s: 0.00
[ 1130s ] thds: 2 tps: 5.70 qps: 114.20 (r/w/o: 79.80/23.00/11.40) lat (ms,99%): 1013.60 err/s: 0.00 reconn/s: 0.00
[ 1140s ] thds: 2 tps: 7.60 qps: 151.31 (r/w/o: 105.91/30.20/15.20) lat (ms,99%): 831.46 err/s: 0.00 reconn/s: 0.00
[ 1150s ] thds: 2 tps: 8.20 qps: 165.09 (r/w/o: 115.90/32.80/16.40) lat (ms,99%): 694.45 err/s: 0.00 reconn/s: 0.00
[ 1160s ] thds: 2 tps: 5.80 qps: 115.40 (r/w/o: 80.60/23.20/11.60) lat (ms,99%): 816.63 err/s: 0.00 reconn/s: 0.00
[ 1170s ] thds: 2 tps: 6.70 qps: 135.50 (r/w/o: 95.00/27.10/13.40) lat (ms,99%): 846.57 err/s: 0.00 reconn/s: 0.00
[ 1180s ] thds: 2 tps: 6.90 qps: 135.10 (r/w/o: 94.00/27.30/13.80) lat (ms,99%): 1129.24 err/s: 0.00 reconn/s: 0.00
[ 1190s ] thds: 2 tps: 6.10 qps: 123.21 (r/w/o: 86.60/24.40/12.20) lat (ms,99%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 1200s ] thds: 2 tps: 6.40 qps: 127.80 (r/w/o: 89.40/25.60/12.80) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 1210s ] thds: 2 tps: 6.00 qps: 120.20 (r/w/o: 84.20/24.00/12.00) lat (ms,99%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 1220s ] thds: 2 tps: 6.70 qps: 133.40 (r/w/o: 93.20/26.80/13.40) lat (ms,99%): 960.30 err/s: 0.00 reconn/s: 0.00
[ 1230s ] thds: 2 tps: 7.20 qps: 144.50 (r/w/o: 101.30/28.80/14.40) lat (ms,99%): 759.88 err/s: 0.00 reconn/s: 0.00
[ 1240s ] thds: 2 tps: 6.60 qps: 132.10 (r/w/o: 92.50/26.40/13.20) lat (ms,99%): 634.66 err/s: 0.00 reconn/s: 0.00
[ 1250s ] thds: 2 tps: 6.90 qps: 137.20 (r/w/o: 95.80/27.60/13.80) lat (ms,99%): 893.56 err/s: 0.00 reconn/s: 0.00
[ 1260s ] thds: 2 tps: 7.10 qps: 142.30 (r/w/o: 99.70/28.40/14.20) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 1270s ] thds: 2 tps: 7.50 qps: 150.50 (r/w/o: 105.50/30.00/15.00) lat (ms,99%): 787.74 err/s: 0.00 reconn/s: 0.00
[ 1280s ] thds: 2 tps: 7.20 qps: 143.70 (r/w/o: 100.50/28.80/14.40) lat (ms,99%): 590.56 err/s: 0.00 reconn/s: 0.00
[ 1290s ] thds: 2 tps: 7.20 qps: 145.20 (r/w/o: 102.00/28.80/14.40) lat (ms,99%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 1300s ] thds: 2 tps: 6.60 qps: 132.61 (r/w/o: 92.80/26.60/13.20) lat (ms,99%): 694.45 err/s: 0.00 reconn/s: 0.00
[ 1310s ] thds: 2 tps: 6.20 qps: 122.00 (r/w/o: 85.00/24.60/12.40) lat (ms,99%): 995.51 err/s: 0.00 reconn/s: 0.00
[ 1320s ] thds: 2 tps: 5.70 qps: 114.30 (r/w/o: 80.10/22.80/11.40) lat (ms,99%): 995.51 err/s: 0.00 reconn/s: 0.00
[ 1330s ] thds: 2 tps: 6.90 qps: 137.80 (r/w/o: 96.40/27.60/13.80) lat (ms,99%): 926.33 err/s: 0.00 reconn/s: 0.00
[ 1340s ] thds: 2 tps: 7.20 qps: 143.09 (r/w/o: 99.90/28.80/14.40) lat (ms,99%): 623.33 err/s: 0.00 reconn/s: 0.00
[ 1350s ] thds: 2 tps: 7.10 qps: 143.10 (r/w/o: 100.50/28.40/14.20) lat (ms,99%): 943.16 err/s: 0.00 reconn/s: 0.00
[ 1360s ] thds: 2 tps: 7.70 qps: 155.70 (r/w/o: 109.30/31.00/15.40) lat (ms,99%): 539.71 err/s: 0.00 reconn/s: 0.00
[ 1370s ] thds: 2 tps: 7.30 qps: 145.10 (r/w/o: 101.50/29.00/14.60) lat (ms,99%): 977.74 err/s: 0.00 reconn/s: 0.00
[ 1380s ] thds: 2 tps: 7.20 qps: 144.50 (r/w/o: 101.10/29.00/14.40) lat (ms,99%): 646.19 err/s: 0.00 reconn/s: 0.00
[ 1390s ] thds: 2 tps: 7.50 qps: 149.40 (r/w/o: 104.60/29.80/15.00) lat (ms,99%): 646.19 err/s: 0.00 reconn/s: 0.00
[ 1400s ] thds: 2 tps: 7.60 qps: 151.30 (r/w/o: 105.70/30.40/15.20) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 1410s ] thds: 2 tps: 6.90 qps: 137.90 (r/w/o: 96.50/27.60/13.80) lat (ms,99%): 1013.60 err/s: 0.00 reconn/s: 0.00
[ 1420s ] thds: 2 tps: 6.80 qps: 135.30 (r/w/o: 94.50/27.20/13.60) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 1430s ] thds: 2 tps: 7.60 qps: 154.10 (r/w/o: 108.50/30.40/15.20) lat (ms,99%): 511.33 err/s: 0.00 reconn/s: 0.00
[ 1440s ] thds: 2 tps: 7.10 qps: 142.20 (r/w/o: 99.50/28.50/14.20) lat (ms,99%): 861.95 err/s: 0.00 reconn/s: 0.00
[ 1450s ] thds: 2 tps: 6.60 qps: 131.10 (r/w/o: 91.60/26.30/13.20) lat (ms,99%): 1149.76 err/s: 0.00 reconn/s: 0.00
[ 1460s ] thds: 2 tps: 7.20 qps: 144.60 (r/w/o: 101.20/29.00/14.40) lat (ms,99%): 601.29 err/s: 0.00 reconn/s: 0.00
[ 1470s ] thds: 2 tps: 7.90 qps: 156.79 (r/w/o: 109.60/31.40/15.80) lat (ms,99%): 458.96 err/s: 0.00 reconn/s: 0.00
[ 1480s ] thds: 2 tps: 7.00 qps: 141.01 (r/w/o: 99.00/28.00/14.00) lat (ms,99%): 559.50 err/s: 0.00 reconn/s: 0.00
[ 1490s ] thds: 2 tps: 7.00 qps: 139.90 (r/w/o: 97.80/28.10/14.00) lat (ms,99%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 1500s ] thds: 2 tps: 6.10 qps: 120.90 (r/w/o: 84.40/24.30/12.20) lat (ms,99%): 926.33 err/s: 0.00 reconn/s: 0.00
[ 1510s ] thds: 2 tps: 7.50 qps: 150.30 (r/w/o: 105.30/30.00/15.00) lat (ms,99%): 816.63 err/s: 0.00 reconn/s: 0.00
[ 1520s ] thds: 2 tps: 6.20 qps: 125.30 (r/w/o: 88.10/24.80/12.40) lat (ms,99%): 861.95 err/s: 0.00 reconn/s: 0.00
[ 1530s ] thds: 2 tps: 7.00 qps: 138.80 (r/w/o: 96.80/28.00/14.00) lat (ms,99%): 1149.76 err/s: 0.00 reconn/s: 0.00
[ 1540s ] thds: 2 tps: 7.20 qps: 142.80 (r/w/o: 99.60/28.80/14.40) lat (ms,99%): 530.08 err/s: 0.00 reconn/s: 0.00
[ 1550s ] thds: 2 tps: 7.90 qps: 159.21 (r/w/o: 111.80/31.60/15.80) lat (ms,99%): 493.24 err/s: 0.00 reconn/s: 0.00
[ 1560s ] thds: 2 tps: 7.30 qps: 145.80 (r/w/o: 102.00/29.20/14.60) lat (ms,99%): 1013.60 err/s: 0.00 reconn/s: 0.00
[ 1570s ] thds: 2 tps: 7.50 qps: 150.90 (r/w/o: 105.70/30.20/15.00) lat (ms,99%): 861.95 err/s: 0.00 reconn/s: 0.00
[ 1580s ] thds: 2 tps: 7.60 qps: 151.20 (r/w/o: 105.80/30.20/15.20) lat (ms,99%): 569.67 err/s: 0.00 reconn/s: 0.00
[ 1590s ] thds: 2 tps: 7.00 qps: 140.79 (r/w/o: 98.79/28.00/14.00) lat (ms,99%): 569.67 err/s: 0.00 reconn/s: 0.00
[ 1600s ] thds: 2 tps: 5.10 qps: 101.81 (r/w/o: 71.20/20.40/10.20) lat (ms,99%): 1129.24 err/s: 0.00 reconn/s: 0.00
[ 1610s ] thds: 2 tps: 3.90 qps: 77.60 (r/w/o: 54.20/15.60/7.80) lat (ms,99%): 1678.14 err/s: 0.00 reconn/s: 0.00
[ 1620s ] thds: 2 tps: 2.80 qps: 55.80 (r/w/o: 39.00/11.20/5.60) lat (ms,99%): 2045.74 err/s: 0.00 reconn/s: 0.00
[ 1630s ] thds: 2 tps: 6.70 qps: 134.80 (r/w/o: 94.60/26.80/13.40) lat (ms,99%): 893.56 err/s: 0.00 reconn/s: 0.00
[ 1640s ] thds: 2 tps: 6.60 qps: 130.80 (r/w/o: 91.20/26.40/13.20) lat (ms,99%): 960.30 err/s: 0.00 reconn/s: 0.00
[ 1650s ] thds: 2 tps: 8.40 qps: 169.00 (r/w/o: 118.60/33.60/16.80) lat (ms,99%): 773.68 err/s: 0.00 reconn/s: 0.00
[ 1660s ] thds: 2 tps: 7.40 qps: 148.00 (r/w/o: 103.50/29.70/14.80) lat (ms,99%): 669.89 err/s: 0.00 reconn/s: 0.00
[ 1670s ] thds: 2 tps: 6.50 qps: 130.80 (r/w/o: 91.80/26.00/13.00) lat (ms,99%): 580.02 err/s: 0.00 reconn/s: 0.00
[ 1680s ] thds: 2 tps: 7.20 qps: 142.10 (r/w/o: 99.00/28.70/14.40) lat (ms,99%): 877.61 err/s: 0.00 reconn/s: 0.00
[ 1690s ] thds: 2 tps: 7.40 qps: 148.59 (r/w/o: 104.19/29.60/14.80) lat (ms,99%): 682.06 err/s: 0.00 reconn/s: 0.00
[ 1700s ] thds: 2 tps: 5.30 qps: 106.91 (r/w/o: 74.90/21.40/10.60) lat (ms,99%): 802.05 err/s: 0.00 reconn/s: 0.00
[ 1710s ] thds: 2 tps: 5.60 qps: 111.79 (r/w/o: 78.29/22.30/11.20) lat (ms,99%): 943.16 err/s: 0.00 reconn/s: 0.00
[ 1720s ] thds: 2 tps: 7.90 qps: 156.60 (r/w/o: 109.30/31.50/15.80) lat (ms,99%): 787.74 err/s: 0.00 reconn/s: 0.00
[ 1730s ] thds: 2 tps: 6.80 qps: 136.80 (r/w/o: 96.00/27.20/13.60) lat (ms,99%): 580.02 err/s: 0.00 reconn/s: 0.00
[ 1740s ] thds: 2 tps: 7.20 qps: 144.39 (r/w/o: 101.09/28.90/14.40) lat (ms,99%): 520.62 err/s: 0.00 reconn/s: 0.00
[ 1750s ] thds: 2 tps: 5.50 qps: 109.60 (r/w/o: 76.70/21.90/11.00) lat (ms,99%): 1235.62 err/s: 0.00 reconn/s: 0.00
[ 1760s ] thds: 2 tps: 3.30 qps: 66.70 (r/w/o: 46.90/13.20/6.60) lat (ms,99%): 2985.89 err/s: 0.00 reconn/s: 0.00
[ 1770s ] thds: 2 tps: 7.20 qps: 142.72 (r/w/o: 99.52/28.80/14.40) lat (ms,99%): 831.46 err/s: 0.00 reconn/s: 0.00
[ 1780s ] thds: 2 tps: 7.60 qps: 152.50 (r/w/o: 106.90/30.40/15.20) lat (ms,99%): 773.68 err/s: 0.00 reconn/s: 0.00
[ 1790s ] thds: 2 tps: 7.20 qps: 143.30 (r/w/o: 100.10/28.80/14.40) lat (ms,99%): 580.02 err/s: 0.00 reconn/s: 0.00
[ 1800s ] thds: 2 tps: 6.30 qps: 126.71 (r/w/o: 88.90/25.20/12.60) lat (ms,99%): 943.16 err/s: 0.00 reconn/s: 0.00
SQL statistics:
queries performed:
read: 167258
write: 47788
other: 23894
total: 238940
transactions: 11947 (6.64 per sec.)
总共11947次事物,平均每秒6.64次
queries: 238940 (132.74 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 1800.0792s
total number of events: 11947
Latency (ms):
min: 2.52最小事件时间
avg: 301.34
max: 2994.72
99th percentile: 1050.76
sum: 3600075.99
Threads fairness:
events (avg/stddev): 5973.5000/0.50
execution time (avg/stddev): 1800.0380/0.02
[root@mysqlcentos01 opt]#
[root@mysqlcentos01 opt]#
总结:
官方的sysbench是不支持--oltp_tables_count=10这个参数的,我们使用的是percona的分支,所以sysbench做oltp的测试并不是很完善,个人愿意用tpcc-mysql
对磁盘IO性能的测试:
创建初始化fileio文件:
[root@mysqlcentos01 ~]# sysbench --test=fileio --file-num=16 --file-total-size=2G prepare
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.9 (using bundled LuaJIT 2.1.0-beta2)
16 files, 131072Kb each, 2048Mb total
Creating files for the test...
Extra file open flags: 0
Creating file test_file.0
Creating file test_file.1
Creating file test_file.2
Creating file test_file.3
Creating file test_file.4
Creating file test_file.5
Creating file test_file.6
Creating file test_file.7
Creating file test_file.8
Creating file test_file.9
Creating file test_file.10
Creating file test_file.11
Creating file test_file.12
Creating file test_file.13
Creating file test_file.14
Creating file test_file.15
2147483648 bytes written in 2.85 seconds (718.41 MiB/sec).
[root@mysqlcentos01 ~]#