打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
服务器使用fio工具对 硬盘压力测试

fio 官网地址:http://freshmeat.net/projects/fio/

安装方法:

yum -y install libaio libaio-devel
wget http://brick.kernel.dk/snaps/fio-2.1.7.tar.bz2

tar xf fio-2.1.7.tar.bz2
cd fio
-2.1.7/
.
/configure 
make -j10
make install

fio测试工具支持同步(pread/pwrite)和异步(libaio)FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。  


二,测试案例介绍: 

##############################  同步i/o   ##################################################################3 

#同步i/o、顺序读: 

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=read-psync >read-psync.txt 

#同步i/o、顺序写: 

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=write-psync >write-psync.txt 

#同步i/o、顺序混合读写: 

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=readwrite -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=rw-readwrite rw-readwrite-psync.txt

#同步i/o、随机读:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randread-psync >randread-psync.txt 

#同步i/o、随机写:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randwrite-psync >randwrite-psync.txt 

#同步i/o、随机混合读写:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=100 -group_reporting -ioscheduler=noop -name=randrw-psync >randrw-psync.txt  

##############################  异步 i/o   ##################################################################3 

 #异步 i/o、顺序读:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=read -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=read-libaio >read-libaio.txt 

#异步 i/o、顺序写: 

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=write -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=write-libaio >write-libaio.txt 

#异步 i/o、顺序混合读写: 

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=readwrite -rwmixread=50 -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=rw-readwrite-libaio >rw-readwrite-psync.txt 

#异步 i/o、随机读:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randread-libaio >randread-libaio.txt 

#异步 i/o、随机写:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randwrite-libaio >randwrite-libaio.txt 

#异步 i/o、随机混合读写:  

fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=100 -group_reporting -ioscheduler=noop -name=randrw-libaio >randrw-libaio.txt  

说明:  

filename=/dev/rbd2 测试文件名称,需要测试的盘的某目录。  

direct=1 测试过程绕过机器自带的buffer。使测试结果更真实。  

read 顺序读 

write 顺序写 

randwrite 随机写 

randread 随机读 

rw,readwrite 顺序混合读写 

randrw 随机混合读写 

bs=16k 单次io的块文件大小为16k  

bsrange=512-2048 同上,提定数据块的大小范围  

size=5g 本次的测试文件大小为5g,以每次4k的io进行测试。  

numjobs=30 本次的测试线程为30.  

runtime=1000 测试时间为1000秒,如果不写则一直将5g文件分4k每次写完为止。  

ioengine=psync io引擎使用pync方式  

rwmixread=30  在混合读写的模式下,读占30% ,默认%50,两个参数同时使用,后者覆盖第一 

rwmixwrite=30 在混合读写的模式下,写占30% ,默认%50 

group_reporting 关于显示结果的,汇总每个进程的信息。  

lockmem=1g 只使用1g内存进行测试。  

zero_buffers 用0初始化系统buffer。  

nrfiles=8 每个进程生成文件的数量。  

ioscheduler 尝试切换设备托管文件指定的I / O调度器。 

psync  同步i/o测试 

libaio  异步i/o测试 

libaio的读写过程简单说来就是你发出一个读写请求,然后你可以开始做其他事情,当读写过程结束时libaio会通知你你的这次请求已经完成 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
linux使用FIO测试磁盘的iops
fio测试及自动画图
使用FIO工具测试块存储性能
io系统的压力测试工具
Linux下异步IO(libaio)的使用以及性能 | 系统技术非业余研究
系统性能测试与监测工具汇总
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服