centos6.8 安装sysbench 以及测试

1,首先安装git,当然不安装用其他办法去下载也可以的。

yum -y install git

2,git方式下载sysbench

 git clone https://github.com/akopytov/sysbench.git

3,安装sysbench

cd sysbench
./autogen.sh 

4,出现错误,然后查找原因:

./autogen.sh: line 3: autoreconf: command not found

yum -y install automake

./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
configure.ac:48: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

yum -y install autoconf libtool

5,安装sysbench

./configure #./configure --without-mysql(不编译测试mysql的功能模块)
make && make install

到此,成功安装,然后测试:

 

测试cpu,计算素数的运行时间

 sybench --test=cpu --cpu-max-prime=20000 run

测试结果:

Prime numbers limit: 20000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:   402.12

General statistics:
    total time:                          10.0021s
    total number of events:              4022

Latency (ms):
         min:                                  2.18
         avg:                                  2.49
         max:                                  6.81
         95th percentile:                      3.25
         sum:                               9995.80

Threads fairness:
    events (avg/stddev):           4022.0000/0.00
    execution time (avg/stddev):   9.9958/0.00

可以看到总的时间10.0021s

测试IO

测试的第一步准备数据,首先要生成测试用到的数据文件,生成的数据文件至少要比内存大,如果文件中的数据能完全放到内存中,则操作系统缓存的大部分数据,导致测试结果无法体现io密集型的工作负载,创建数据集:

[root@localhost ~]# sysbench --test=fileio --file-total-size=5G prepare
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.1.0-dcde0d9 (using bundled LuaJIT 2.1.0-beta3)

128 files, 40960Kb each, 5120Mb 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

然后运行阶段:

针对IO类型有不同的测试选项:

seqwr           顺序写入
seqrewr        顺序重写
seqrd           顺序读取
rndrd           随机读取
rndwr           随机写入
rdnrw           混合随机读/写

IO 混合随机读写测试:

[root@localhost ~]# sysbench --test=fileio --file-total-size=5G --file-test-mode=rndrw  --max-time=300 --max-requests=0 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
WARNING: --max-time is deprecated, use --time instead
sysbench 1.1.0-dcde0d9 (using bundled LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Extra file open flags: 0
128 files, 40MiB each
5GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!


File operations:
    reads/s:                      4058.22
    writes/s:                     2705.48
    fsyncs/s:                     8657.43

Throughput:
    read, MiB/s:                  63.41
    written, MiB/s:               42.27

General statistics:
    total time:                          300.1206s
    total number of events:              4628197

Latency (ms):
         min:                                  0.00
         avg:                                  0.06
         max:                                565.05
         95th percentile:                      0.10
         sum:                             295385.06

Threads fairness:
    events (avg/stddev):           4628197.0000/0.00
    execution time (avg/stddev):   295.3851/0.00

最后清理数据:

[root@localhost ~]# sysbench --test=fileio --file-total-size=5G cleanup
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.1.0-dcde0d9 (using bundled LuaJIT 2.1.0-beta3)

Removing test files...

 

posted @ 2017-08-02 22:46  yijiaotu  阅读(894)  评论(0)    收藏  举报