sysbench
fileio
与文件IO性能评价密切相关的指标有:每秒钟请求数、吞吐量、95%以上事件响应时间。
sysbench --test=fileio --file-total-size=5G prepare
--test=fileio 表示测试类型为内建的fileio测试
--test-total-size=5G 表示准备测试数据集为50G大小
prepare 命令准备测试数据集
sysbench --test=fileio help
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,mmap} [sync] \/\/io模式,“同步”、“异步”
--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] \/\/fsync()方法调用频率
--file-fsync-all=[on|off] do fsync() after each write operation [off] \/\/每一次写操作都进行fsync()同步,默认为off
--file-fsync-end=[on|off] do fsync() at the end of test [on] \/\/在测试结束之前调用fsync()同步方法
--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 possible (0 - don't merge) [0]
--file-rw-ratio=N reads\/writes ratio for combined test [1.5] \/\/读写比率设定
sysbench --test=fileio --file-test-mode=rndrw --file-total-size=5G --file-rw-ratio=2 run
--test-fileio:测试类型为IO测试
--file-total-size=5G:测试文件总大小为5G
--file-test-mode=rndrw:文件IO测试模式为随机混合读写方式
--file-rw-ratio=2:读写次数比率为2
sysbench --test=fileio --file-total-size=5G cleanup
报表解读
sysbench 1.0: multi-threaded system evaluation benchmark
Running the test with following options:
Number of threads: 1 \/\/测试线程数
Initializing random number generator from current time
\/\/测试属性设定,可以通过选项控制
Extra file open flags: 0
files, 40MiB each
5GiB total file size
Block size 16KiB
Number of IO requests: 10000
Read\/Write ratio for combined random IO test: 2.00
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: 95.45 \/\/每秒钟读请求数
writes\/s: 47.72 \/\/每秒钟写请求数
fsyncs\/s: 183.25 \/\/没表中同步次数
\/\/吞吐率
Throughput:
read, MiB\/s: 1.49 \/\/读,1.49MB每秒
written, MiB\/s: 0.75 \/\/写,0.75MB每秒
\/\/统计数据
General statistics:
total time: 69.8488s \/\/测试总时长
total number of events: 10000 \/\/事件数量
total time taken by event execution: 39.6674s \/\/事件执行事件
response time: \/\/事件响应事件统计
min: 0.02ms \/\/最短
avg: 3.97ms \/\/平均
max: 27.70ms \/\/最长
approx. 95 percentile: 11.77ms \/\/95%以上事件响应时长
Threads fairness: \/\/线程公平性统计信息
events (avg\/stddev): 10000.0000\/0.00
execution time (avg\/stddev): 39.6674\/0.00
参考
衡量存储性能一般看吞吐量(传输速度)和IOPS两个指标。
吞吐量主要指大文件的连续读写速度,在大文件的复制、备份等场景适用,用“HD Tune专业版”中的“基准”测试功能即可测试出磁盘的吞吐量,一般传统机械sata硬盘的顺序读写速度为 :80~150M\/s, SAS硬盘为150~200M\/s,SSD固态硬盘为400~600M\/s。
西部数码弹性云主机, 在正常负载情况下的顺序读取速度为100~300M\/s,集群空载情况下测试速度为400~700M\/s。顺序写速度约为30~70M\/s。
随机读写性能也是衡量硬盘表现的重要指标,它基本上代表了硬盘在读写散布在各个位置的小文件时的性能表现,一般以4KB文件大小为标准,IOPS(I\/Os per second)即每秒输入输出次数。 在网站WEB应用及数据库应用中,通常是若干随机小文件的读写,故存储的IOPS若太低则在高访问量的情况下可能会成为性能瓶颈。 用“HD Tune专业版5.50”中的“文件基准”功能可以测试 IOPS性能,一般以4K大小对应的iops指标做为参考:
常见硬盘IOPS参考值:
7200转SATA硬盘:随机读写约90 IOPS
15000转SAS硬盘:随机读写约180 IOPS
2013年主流的SSD固态硬盘:随机读写约5000~60000 (不同品牌的产品各有不同)
西部数码弹性云主机使用“分布式存储”模式时,峰值: 单一随机读IOPS约为3000~6000,单一随机写IOPS约为800~1000。 iops平均值:读500,写150左右
西部数码弹性云主机使用“SSD固态硬盘”模式时,峰值:单一随机读IOPS约为5000~40000,单一随机写IOPS约为4000~30000。iops平均值:读1000,写250左右
自测腾讯云:
随机读read: 10.50 MiB\/s
随机写written: 14.05MiB\/s = 117.8599424MB\/s
读写混合:read:7.15MiB\/s = 59.9785472MB\/s,written:3.58MiB\/s