fio的配置使用

将fio-2.1.10.tar.gz拷贝到linux服务器的/usr/src/下

解压源码包:

1
2
root@grandocean:/usr/src# tar xvf fio-2.1.10.tar.gz 
root@grandocean:/usr/src# cd fio-2.1.10/

安装依赖包:

1
root@grandocean:/usr/src/fio-2.1.10# apt-get install pkg-config gtk+-2.0 libaio-dev 

开启gfio:

1
root@grandocean:/usr/src/fio-2.1.10# ./configure --enable-gfio 

编译fio:

1
root@grandocean:/usr/src/fio-2.1.10# make fio 

编译gfio:

1
root@grandocean:/usr/src/fio-2.1.10# make gfio 

启动server模式:

1
root@grandocean:/usr/src/fio-2.1.10# ./fio -S

测试脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/sh
echo "-------------------------------------------------------------------------------"
echo "iozone测试" > result.fio
iozone -i 0 -i 1 -i 2 -i 5 -r 4M -s 16G -f /mnt/test1/iotestthru.iso >> result.fio
sleep 30
echo "-------------------------------------------------------------------------------"
echo "顺序读" >> result.fio
fio -filename=/mnt/fio/cachethrusqread -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1200 -group_reporting -name=cachesqread >> result.fio
sleep 30
echo "-------------------------------------------------------------------------------"
echo "顺序写" >> result.fio
fio -filename=/mnt/fio/cachethrusqwrite -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1200 -group_reporting -name=cachewrite
sleep 30
echo "-------------------------------------------------------------------------------"
echo "随机写" >> result.fio
fio -filename=/mnt/fio/cachethrurandwrite -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1200 -group_reporting -name=cacherandwrite >> result.fio
sleep 30
echo "-------------------------------------------------------------------------------"
echo "随机读" >> result.fio
fio -filename=/mnt/fio/cachethrurandread -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1200 -group_reporting -name=cacherandread >> result.fio
sleep 30
echo "-------------------------------------------------------------------------------"
echo "随机读写比例各50%" >> result.fio
fio -filename=/mnt/fio/cachethrurandreadwrite -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1200 -group_reporting -name=cacherandreadwrite >> result.fio
echo "-------------------------------------------------------------------------------"

centos7 安装

下载

https://github.com/axboe/fio/archive/fio-3.26.tar.gz

这个版本对gcc有要求,需要支持c11,需要升级到gcc 4.9版本或者以上

yum install centos-release-scl -y
yum install devtoolset-7-toolchain -y
scl enable devtoolset-7 bash
执行完gcc升级到7.3.1了

安装ui相关的库
yum install libgnomeui-devel

make fio
make gfio

FIO的几个测试模型

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh
# SEQ 1M Q8 T1
fio -direct=1 -iodepth=8 -rw=write -ioengine=libaio -bs=1M -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q8T1-SEQ1M1G-WRITE >> resoult.txt
sleep 5;sync;
fio -direct=1 -iodepth=8 -rw=read -ioengine=libaio -bs=1M -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q8T1-SEQ1M1G-READ >> resoult.txt
sleep 5;sync;
# SEQ 1M Q1T1
fio -direct=1 -iodepth=1 -rw=write -ioengine=libaio -bs=1M -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q1T1-SEQ1M1G-WRITE >> resoult.txt
sleep 5;sync;
fio -direct=1 -iodepth=1 -rw=read -ioengine=libaio -bs=1M -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q1T1-SEQ1M1G-READ >> resoult.txt
sleep 5;sync;
# Q32T1-RND4K
fio -direct=1 -iodepth=32 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q32T1-RND4K1G-WRITE >> resoult.txt
sleep 5;sync;
fio -direct=1 -iodepth=32 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q32T1-RND4K1G-READ >> resoult.txt
sleep 5;sync;
# Q1T1-RND4K Q1 T1
fio -direct=1 -iodepth=1 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q1T1-RND4K1G-WRITE >> resoult.txt
sleep 5;sync;
fio -direct=1 -iodepth=1 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=120 -group_reporting -filename=/nvmedisk/test.temp -name=Q1T1-RND4K1G-READ >> resoult.txt
sleep 5;sync;

这个对应到diskwindows测试工具的io模型,可以根据自己的需要进行修改