安装
centos
yum install sysbench
mac
brew install sysbench
wl@wldeiMac:/tmp$ sysbench --test=fileio --file-total-size=2G prepare 2147483648 bytes written in 4.78 seconds (428.25 MiB/sec).
对当前目录下写入共2G的文件,当前目录下就会出现很多个8MB大小的文件
Mac 闪存可以达到650MB/SEC
sysbench --test=fileio --num-threads=10 --file-total-size=2G --file-test-mode=rndrw --report-interval=1 run
参数解读
--num-threads=10 开启10个线程
--file-total-size=2G 测试文件总大小2G
--file-test-mode=rndrw 文件读写模式 混合读写
--report-interval=1 每隔一秒输出一次结果
Threads started! [ 1s ] reads: 289.53 MiB/s writes: 193.03 MiB/s fsyncs: 39424.46/s latency (ms,95%): 0.417 [ 2s ] reads: 340.99 MiB/s writes: 227.32 MiB/s fsyncs: 46640.08/s latency (ms,95%): 0.395 [ 3s ] reads: 375.53 MiB/s writes: 250.25 MiB/s fsyncs: 51195.05/s latency (ms,95%): 0.388 [ 4s ] reads: 396.08 MiB/s writes: 264.17 MiB/s fsyncs: 54110.92/s latency (ms,95%): 0.388 [ 5s ] reads: 442.64 MiB/s writes: 295.09 MiB/s fsyncs: 60485.17/s latency (ms,95%): 0.388 [ 6s ] reads: 474.70 MiB/s writes: 316.36 MiB/s fsyncs: 64776.91/s latency (ms,95%): 0.388 [ 7s ] reads: 501.59 MiB/s writes: 334.39 MiB/s fsyncs: 68502.04/s latency (ms,95%): 0.388 [ 8s ] reads: 538.96 MiB/s writes: 359.41 MiB/s fsyncs: 73502.49/s latency (ms,95%): 0.381 [ 9s ] reads: 567.17 MiB/s writes: 378.12 MiB/s fsyncs: 77543.71/s latency (ms,95%): 0.367 [ 10s ] reads: 554.22 MiB/s writes: 369.48 MiB/s fsyncs: 76668.79/s latency (ms,95%): 0.354 File operations: reads/s: 28671.85 writes/s: 19114.57 fsyncs/s: 61289.42 Throughput: read, MiB/s: 448.00 written, MiB/s: 298.67 General statistics: total time: 10.0047s total number of events: 1090108 Latency (ms): min: 0.00 avg: 0.09 max: 36.39 95th percentile: 0.39 sum: 96843.92 Threads fairness: events (avg/stddev): 109010.8000/760.11 execution time (avg/stddev): 9.6844/0.00
95%的相应时间为 0.39毫秒
吞吐量
读 448MB每秒
写 298MB每秒
sysbench --test=fileio help
对于文件IO测试的其他参数