Created
May 20, 2014 02:44
-
-
Save zhanghui9700/8b233584dbc76f48d055 to your computer and use it in GitHub Desktop.
use fio to test disk io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#fio 是测试磁盘性能的最佳工具: | |
#1、测试顺序读性能 | |
fio --filename=/home/test -iodepth=64 -ioengine=libaio --direct=1 --rw=read --bs=1m --size=2g --numjobs=4 --runtime=10 --group_reporting --name=test-read | |
#2、测试顺序写性能 | |
fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=write -bs=1m -size=2g -numjobs=4 -runtime=20 -group_reporting -name=test-write | |
#3、测试随机读性能 | |
fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=randread -bs=4k -size=2G -numjobs=64 -runtime=20 -group_reporting -name=test-rand-read | |
#4、测试随机写性能 | |
fio -filename=/home/test -iodepth=64 -ioengine=libaio -direct=1 -rw=randwrite -bs=4k -size=2G -numjobs=64 -runtime=20 -group_reporting -name=test-rand-write | |
<<` | |
参数说明: | |
filename=/home/test 测试文件名称,通常选择需要测试的盘的data目录。 | |
direct=1 测试过程绕过机器自带的buffer。使测试结果更真实。 | |
rw=randwrite 测试随机写的I/O | |
rw=randrw 测试随机写和读的I/O | |
bs=4k 单次io的块文件大小为4k | |
size=2g 本次的测试文件大小为2g,以每次4k的io进行测试。 | |
numjobs=64 本次的测试线程为64. | |
runtime=20 测试时间为20秒,如果不写则一直将2g文件分4k每次写完为止。 | |
报告如何查看: | |
fio的结果报告内容丰富,我们主要关心的是两项: | |
磁盘的吞吐量bw,这个是顺序读写考察的重点 | |
磁盘的每秒读写次数iops,这个是随机读写考察的重点 | |
比如,下面是4个测试的结果部分截取: | |
test-read: (groupid=0, jobs=4): err= 0: pid=4752 | |
read : io=839680KB, bw=76823KB/s, iops=75 , runt= 10930msec | |
顺序读,带宽76823KB/s,iops 75 | |
test-write: (groupid=0, jobs=4): err= 0: pid=4758 | |
write: io=899072KB, bw=42854KB/s, iops=41 , runt= 20980msec | |
顺序写,带宽42854KB/s, iops=41 | |
test-rand-read: (groupid=0, jobs=64): err= 0: pid=4619 | |
read : io=72556KB, bw=3457.4KB/s, iops=864 , runt= 20986msec | |
随机读,带宽3457.4KB/s, iops=864 | |
test-rand-write: (groupid=0, jobs=64): err= 0: pid=4685 | |
write: io=129264KB, bw=6432.4KB/s, iops=1608 , runt= 20097msec | |
随机写,带宽6432.4KB/s, iops=1608 | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment