1. 文件IO测试
[root@RedHat test]# sysbench --test=fileio help
sysbench v0.4.8: multi-threaded system evaluation benchmark
fileio options:
--file-num=N number of files to create [128]
--file-block-size=N block size to use in all IO operations [16384]
--file-total-size=SIZE total size of files to create [2G]
--file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw}
--file-io-mode=STRING file operations mode {sync,async,fastmmap,slowmmap} [sync]
--file-extra-flags=STRING additional flags to use on opening files {sync,dsync,direct} []
--file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100]
--file-fsync-all=[on|off] do fsync() after each write operation [off]
--file-fsync-end=[on|off] do fsync() at the end of test [on]
--file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync]
--file-merged-requests=N merge at most this number of IO requests if poss ible (0- don't merge) [0]
--file-rw-ratio=N reads/writes ratio for combined test [1.5]
[root@RedHat test]#
参数选项说明:
|
参数名 |
描述 |
|
--file-num=N |
创建的文件数目,默认为128个 |
|
--file-block-size=N |
所有IO操作中的block大小,默认是16384 |
|
--file-total-size=SIZE |
创建的文件的总大小,默认为2G |
|
--file-test-mode=STRING |
测试的访问模式,可选一下6个参数:seqwr(顺序写)/seqrewr(顺序读写)/seqrd(顺序读)/ rndwr(随机写)/rndrw(随机读写)/rndrd(随机读); |
|
--file-io-mode=STRING |
文件操作模式,有以下四种选择:sync,async,fastmmap,slowmmap默认为sync |
|
--file-extra-flags=STRING |
打开文件是的标识,有以下选择:sync,dsync,direct |
|
--file-fsync-freq=N |
在N个请求之后执行fsync(),默认值为100,0表示不执行fsync() |
|
--file-fsync-all=[on|off] |
是否每一次写操作之后均执行fsync() |
|
--file-fsync-end=[on|off] |
在测试结束时执行fsync(),默认开启 |
|
--file-fsync-mode=STRING |
同步使用什么方法:fsync, fdatasync,默认为fsync |
|
--file-merged-requests=N |
尽可能的合并N个请求,0表示不合并,默认为0 |
|
--file-rw-ratio=N |
读写比例默认为1.5:1 |
测试案例:
创建2个进程,创建的文件总大小为3G,文件读写模式为随机读。
可以获取读写速度~
|
[root@RedHat test]# sysbench --test=fileio --num-threads=2 --file-total-size=512M --file-test-mode=rndrw prepare (准备测试文件) sysbench v0.4.8: multi-threaded system evaluation benchmark
128 files, 4096Kb each, 512Mb total Creating files for the test... [root@RedHat test]# sysbench --test=fileio --num-threads=2 --file-total-size=512M --file-test-mode=rndrw run (运行测试) sysbench v0.4.8: multi-threaded system evaluation benchmark
Running the test with following options: Number of threads: 2
Extra file open flags: 0 128 files, 4Mb each 512Mb total file size Block size 16Kb Number of random requests for random IO: 10000 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 Threads started! Done.
Operations performed: 6000 Read, 4000 Write, 12800 Other = 22800 Total Read 93.75Mb Written 62.5Mb Total transferred 156.25Mb (3.2979Mb/sec) 211.07 Requests/sec executed
Test execution summary: total time: 47.3783s total number of events: 10000 total time taken by event execution: 36.6912 per-request statistics: min: 0.0000s avg: 0.0037s max: 0.2687s approx. 95 percentile: 0.0230s
Threads fairness: events (avg/stddev): 5000.0000/180.00 execution time (avg/stddev): 18.3456/0.19
[root@RedHat test]# sysbench --test=fileio --num-threads=2 --file-total-size=512M --file-test-mode=rndrw cleanup (清除测试文件) sysbench v0.4.8: multi-threaded system evaluation benchmark
Removing test files... [root@RedHat test]# |
