1. 下载 Sysbench 0.5
sysbench-0.5.tar.gz
2. 解压
tar zxf sysbench-0.5.tar.gz
3. 安装
[root@test2 sysbench-0.5]# ./autogen.sh
automake 1.10.x (aclocal) wasn't found, exiting
[root@test2 sysbench-0.5]# yum install automake -y
[root@test2 sysbench-0.5]# ./autogen.sh
libtoolize 1.4+ wasn't found, exiting
[root@test2 sysbench-0.5]# yum install -y libtool
[root@test2 sysbench-0.5]# ./autogen.sh
PS:如果没有出现上面红色错误,则执行 ./autogen.sh 这个即可。
[root@test2 sysbench-0.5]# ./configure
[root@test2 sysbench-0.5]# make & make install
[root@test2 sysbench-0.5]# sysbench --version
sysbench: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[root@test2 sysbench-0.5]# export LD_LIBRARY_PATH=/usr/local/mysql/lib
4.测试
创建测试文件存放目录,并 cd 进去
生成测试文件:
[root@test2 sysbench_test]#sysbench --test=fileio --file-num=4 --file-block-size=8192 --file-total-size=10G --file-test-mode=rndrd --file-extra-flags=direct prepare
--test:测试类型,fileio 表示进行 IO 测试;
--file-num:生成的文件数量;
--file-block-size:文件块大小;
--file-total-size:文件总大小;
--file-test-mode:读取规则,rndrd表示随机读;
--file-extra-flags:测试模式;
prepare:生成测试文件;
性能测试:
[root@test2 sysbench_test]#sysbench --test=fileio --file-num=4 --file-block-size=8192 --file-total-size=10G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=30 --num-threads=16 --report-interval=3 run
--max-requests:最大请求数量,0表示不限制;
--max-time:测试时间,单位s;
--num-threads:线程数;
--report-interval:每个几秒在打印一次报告、
run:运行测试;
sysbench 0.5: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 16
Report intermediate results every 3 second(s)
Random number generator seed is 0 and will be ignored
Threads started!
[ 3s] reads: 105.26 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 6s] reads: 105.19 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 9s] reads: 108.34 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 12s] reads: 117.87 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 15s] reads: 114.39 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 18s] reads: 96.25 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 21s] reads: 108.00 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 24s] reads: 114.03 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
[ 27s] reads: 116.36 MB/s writes: 0.00 MB/s fsyncs: 0.00/s
Operations performed: 419156 reads, 0 writes, 0 Other = 419156 Total
Read 3.1979Gb Written 0b Total transferred 3.1979Gb (109.15Mb/sec)
13971.13 Requests/sec executed 这里就是IOPS(随机读的IOPS)
Test execution summary:
total time: 30.0016s
total number of events: 419156
total time taken by event execution: 470.5694s
per-request statistics:
min: 0.09ms
avg: 1.12ms
max: 46.10ms
approx. 95 percentile: 3.29ms
Threads fairness:
events (avg/stddev): 26197.2500/254.38
execution time (avg/stddev): 29.4106/0.06
清理测试文件:
[root@test2 sysbench_test]# sysbench --test=fileio --file-num=4 --file-block-size=8192 --file-total-size=1G --file-test-mode=rndrd --file-extra-flags=direct --max-requests=0 --max-time=30 --num-threads=16 --report-interval=3 cleanup
技术交流群:586892817