fio磁盘测试
文章目录
1.fio 介绍
fio是一个基于命令行的磁盘测试工具, 能够准确的反映出磁盘的性能。 fio是C语言写的, 所以可以通过源码在不同平台进行编译安装。
https://github.com/axboe/fio
2. 安装
fio的安装需要一些依赖包, 而且fio测试需要指定引擎, 比如linux下常用引擎为 libaio
, windows下有专用的 windowsaio
。
2.1 libaio
libaio是fio的测试引擎
$: yum install -y libaio libaio-devel |
or
$: wget http://common-pkgs.oss-cn-beijing.aliyuncs.com/fio/libaio-0.3.109-13.el7.x86_64.rpm |
2.2 下载fio源码包
$: wget http://common-pkgs.oss-cn-beijing.aliyuncs.com/fio/fio-2.21.tar.gz |
2.3 安装gcc编译器
$: yum install -y gcc |
2.4 安装fio
$: tar zxvf fio-2.21.tar.gz |
3. 测试
3.1 参数介绍
ioengine : 引擎 |
3.2 参数选择
- 测试IOPS时,
bs=4k
,iodepth=128
, rw选择随机读、 写 - 测试bandWidth时,
bs=1024k
,iodepth=64
, rw选择顺序读、 写 - 测试latency时,
bs=4k
,iodepth=1
, rw选择随机读、 写
3.3 案例
多路随机写磁盘测试
$: fio -filename=/dev/sdc -direct=1 -iodepth=128 -thread -rw=randwrite -ioengine=libaio -bs=4k -size=10G -numjobs=1 -runtime=300 -group_reporting -name=iotest |
2. 单路随机读写测试, 读占70%。
$: fio -filename=/dev/sdc -direct=1 -iodepth=1 -thread -rw=randrw rwmixread=70 -ioengine=libaio -bs=4k -size=10G -numjobs=1 -runtime=300 -group_reporting -name=iotest |
3.4 多块盘测试
多块磁盘测试方法与单盘相同, 有几块磁盘就同时跑几个fio测试, 测试结束后, 结果相加即为IOPS或BandWidth结果。
4. 结果分析
本文作者: GeekerHua
本文链接: https://blog.geekerhua.com/fio/
文章首发: 同步首发于 语雀 及 GeekerHua的blog
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!