FIO针对一块磁盘 串行执行压测的方式
作者:互联网
目标:磁盘随机读 随机写 以及吞吐数据测试
方法:
1、安装fio
2、编写.sh,执行4k 随机读 4k随机写 1024 读 1024k写
#/bin/bash
date
echo "!!!!!!!!Run 4K Rand Read !!!!!!!!"
fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randread -bs=4K -size=1G -time_based -runtime=60 -name=4krandread -directory=/mnt >4krandread.log
sleep 10
echo "!!!!!!!!Run 4K Rand Write !!!!!!!!"
fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randwrite -bs=4K -size=1G -time_based -runtime=60 -name=4krandwrite -directory=/mnt>4krandwrite.log
sleep 10
echo "!!!!!!!!Run 1M Rand Read !!!!!!!!"
fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randread -bs=1M -size=1G -time_based -runtime=60 -name=1Mrandwrite -directory=/mnt>1Mrandread.log
sleep 10
echo "!!!!!!!!Run 1M Rand Write !!!!!!!!"
fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randwrite -bs=1M -size=1G -time_based -runtime=60 -name=1Mrandwrite -directory=/mnt >1Mrandwrite.log
注:上述参数也可以通过参数化来实现
3、编写.sh 处理数据
取出4k 的iops lat:avg
取出1024K bw值
#/bin/bash
for name in '*.log'
do
echo $name
cat $name |grep "write:" -A 3|grep 'lat'|awk 'END {print}'|egrep -o "\([a-z]+\)|avg=[0-9. ]+"|sort |xargs|tr -d "avg=sec\(\) " >$name_lat.log
done
4、统计结果
标签:based,log,压测,mnt,FIO,串行,echo,fio,name 来源: https://blog.csdn.net/u013180576/article/details/121563057