系统:CentOS 7.4

工具:sysbench 1.0.17

测试IO性能分三个阶段:准备阶段、运行阶段和清理阶段

准备阶段:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# sysbench --file-num=20 --threads=20 --file-total-size=100G --events=1000000 --file-test-mode=rndrw prepare
sysbench 1.0.17 (using system LuaJIT 2.0.4)
FATAL: Cannot find benchmark 'prepare': no such built-in testfile or module
[root@server-254-163 ~]
[root@server-254-163 ~]
[root@server-254-163 ~]# sysbench --file-num=20 --threads=20 fileio --file-total-size=20G --events=1000000 --file-test-mode=rndrw prepare
sysbench 1.0.17 (using system LuaJIT 2.0.4)
20 files, 1048576Kb each, 20480Mb total
Creating files for the test...
Extra file open flags: (none)
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
Creating file test_file.16
Creating file test_file.17
Creating file test_file.18
Creating file test_file.19
21474836480 bytes written in 104.50 seconds (195.98 MiB/sec).

运行阶段:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# sysbench --file-num=20 --threads=20 fileio --file-total-size=20G --events=1000000 --file-test-mode=rndrw run
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Running the test with following options:
Number of threads: 20
Initializing random number generator from current time
Extra file open flags: (none)
20 files, 1GiB each
20GiB total file size
Block size 16KiB
Number of IO requests: 1000000
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:                      13448.73
    writes/s:                     8965.95
    fsyncs/s:                     4522.55
Throughput:
    read, MiB/s:                  210.14
    written, MiB/s:               140.09
General statistics:
    total time:                          10.0038s
    total number of events:              269178
Latency (ms):
         min:                                    0.00
         avg:                                    0.74
         max:                                   20.33
         95th percentile:                        5.47
         sum:                               199496.81
Threads fairness:
    events (avg/stddev):           13458.9000/333.61
    execution time (avg/stddev):   9.9748/0.00

清理阶段:

1
2
3
sysbench --file-num=20 --threads=20 fileio --file-total-size=20G --events=1000000 --file-test-mode=rndrw cleanup
sysbench 1.0.17 (using system LuaJIT 2.0.4)
Removing test files...