磁盘性能检测(time&&fio)

发布时间 2023-12-23 19:28:40作者: chy_cug

一、time命令:
time dd if=/tmp/test1 of=/tmp/test2 bs=8k count=51200 oflag=dsync
参数说明:
1、time 有计时作用,dd 用于复制,从 if 读出,写到 of;
2、if=/dev/zero 不产生 IO,因此可以用来测试纯写速度;
3、同理 of=/dev/null 不产生 IO,可以用来测试纯读速度;
4、将/tmp/test1 拷贝到/tmp/test2,则同时测试了读写速度;
5、bs 是每次读或写的大小,即一个块的大小,count 是读写块的数量。
6、oflag:
direct模式:把写入请求直接封装成io 指令发到磁盘;
非direct模式:把数据写入系统缓存,然后就认为io 成功,并由操作系统决定缓存中的数据什么时候被写入磁盘
其中:
oflag=sync,每个 I/O 写入,都需要直接落到 物理存储 的 元数据和 真实数据
oflag=dsync,每个 I/O 写入,都需要直接落到 物理存储 的 真实数据
conv=fsync,只要求在 dd 命令结束前,将所有数据落到物理存储中
二、fio命令:
#fio读测试
fio -filename=/data/fio_rand_testfile -direct=1 -iodepth=32 -thread -rw=randread -ioengine=libaio -bs=16k -size=10G -numjobs=8 -runtime=120 -group_reporting -name=mytest
#fio写测试
fio -filename=/data/fio_rand_testfile -direct=1 -iodepth=32 -thread -rw=randwrite -ioengine=libaio -bs=16k -size=10G -numjobs=8 -runtime=120 -group_reporting -name=mytest
#fio读写测试
fio -filename=/data1/fio_rand_testfile -direct=1 -iodepth=32 -thread -rw=randrw -ioengine=libaio -bs=16k -size=10G -numjobs=8 -runtime=120 -group_reporting -name=mytest
见https://baijiahao.baidu.com/s?id=1782101210392489357&wfr=spider&for=pc