FIO详解

article/2025/10/15 22:44:47

fio - Flexible IO Tester

一、服务器配置:

由于我们想通过fio得到SSD真实的参数信息,因此我们需要服务器BIOS一些参数的配合,以便能更好的体现硬盘的性能。
在这里插入图片描述
以华为1288HV5为例:
在这里插入图片描述

二、fio

1.安装

a.下载地址:http://freshmeat.sourceforge.net/projects/fio/
b.安装两个插件
#yum install libaio*
#yum install zlib*
c.编译安装
#tar -xvf fio-2.1.10.tar.gz
#cd fio-2.1.10
#./configure
#make
#make install

备注:
最新的fio可以在https://github.com/axboe/fio进行下载,但可能会由于系统自带的gcc版本较低导致无法顺利安装。
升级gcc后即可顺利安装。升级gcc请参考:https://blog.csdn.net/weixin_40343504/article/details/107843661

2.fio执行脚本顺序

1)Secure erase the drive
2)Prefill the drive with Sequential Write (128K Sequential Write QD=32 / size=100% with loops=2 / numjobs=1)
3)128K 100% Sequential Write (ramp_time=60sec / runtime=2h / QD=32 / numjobs=1)
4)128K 100% Sequential Read (ramp_time=60sec / runtime=2h / QD=32 / numjobs=1)

5)Prefill the drive with randwrite (128K randwrite QD=32 / runtime=3hr / numjobs=1)
6) 4K 100% Random Write (ramp_time=60sec / runtime=2h / QD=32 / numjobs=1)
7)4K 100% Random Read (ramp_time=60sec / runtime=2h / QD=32 / numjobs=1)

注意事项:
a.硬盘应直连主板这样测出来的数据更加真实,但如SATA通过Raid Card连接应将硬盘设置为JBOD。
b.硬盘测试前一定要进行安全擦除。
c.顺序读、顺序写前可以不添加稳态处理。
d.随机读、随机写前一定要有randwrite 2h(这个时间与硬盘容量大小有关,4T以下设置2个小时应该没有问题)左右的稳态处理,如果没有添加会影响Random write。下图就是在随机读写前未加稳态处理时,rand_write iops的图
在这里插入图片描述
e.测试时间runime的值应尽量不低于1h,如果时间很短没有测试实际意义。

3.执行脚本,以SATA接口硬盘为例:

./SATA.sh sdb

#**************************Script of precondition*************************#
echo "$DEV precondition seq write ready"
date
fio --ioengine=libaio --direct=1 --thread --norandommap --filename=/dev/"$DEV" --name="$DEV"_init_seq --output="$DEV"_init_seq.log --rw=write --bs=128k --numjobs=1 --iodepth=128 --loops=2#**************************Script of seq*************************#
for WL2 in write read
dofor jobs2 in 1dofor QD2 in 128dofor runt2 in 1800dofor block2 in 128kdoecho "$DEV rw_${WL2}  bs_${block2} nujobs_${jobs2} QD_${QD2} test      "
date
issdcm -drive_index 0 -smart >"$DEV"_${block2}_${WL2}_${jobs2}_${QD2}_smart.log
fio --ioengine=libaio --randrepeat=0 --norandommap --thread --direct=1 --group_reporting --name=mytest --ramp_time=60 --runtime=${runt2} --time_based --numjobs=${jobs2} --iodepth=${QD2} --filename=/dev/"$DEV" --rw=${WL2} --bs=${block2} --output="$DEV"_${block2}_${WL2}_${jobs2}_${QD2}.log --log_avg_msec=1000 --write_iops_log="$DEV"_${block2}_${WL2}_${jobs2}_${QD2}_iops --write_lat_log="$DEV"_${block2}_${WL2}_${jobs2}_${QD2}_lat --write_bw_log="$DEV"_${block2}_${WL2}_${jobs2}_${QD2}_bwdonedonedonedone
done
#**************************Script of precondition*************************#
echo "$DEV precondition random write ready"
date
fio --ioengine=libaio --direct=1 --thread --norandommap --filename=/dev/"$DEV" --name="$DEV"_init_random --output="$DEV"_init2_random.log --rw=randwrite --bs=128k --numjobs=4 --iodepth=64 --time_based --ramp_time=60 --runtime=7200
#**************************Script of random*************************#
for WL in randwrite randread
dofor jobs in 4dofor QD in 64dofor runt in 1800dofor block in 8k 4kdo	echo "$DEV rw_${WL} bs_${block} nujobs_${jobs} QD_${QD} test    "
date
issdcm -drive_index 0 -smart >"$DEV"_${block}_${WL}_${jobs}_${QD}_smart.log
fio --ioengine=libaio --randrepeat=0 --norandommap --thread --direct=1 --group_reporting --name=mytest --ramp_time=60 --runtime=${runt} --time_based --numjobs=${jobs} --iodepth=${QD} --filename=/dev/"$DEV" --rw=${WL} --bs=${block} --output="$DEV"_${block}_${WL}_${jobs}_${QD}.log --log_avg_msec=1000 --write_iops_log="$DEV"_${block}_${WL}_${jobs}_${QD}_iops --write_lat_log="$DEV"_${block}_${WL}_${jobs}_${QD}_latdonedonedonedone
done#**************************Script of randrw*************************#
for WL1 in randrw
dofor jobs1 in 4dofor QD1 in 64dofor runt1 in 1800dofor block1 in 8k 4kdo	echo "$DEV rw_${WL1}  bs_${block1} nujobs_${jobs1} QD_${QD1} test    "
date
issdcm -drive_index 0 -smart >"$DEV"_${block1}_${WL1}_${jobs1}_${QD1}_smart.log
fio --ioengine=libaio --randrepeat=0 --norandommap --thread --direct=1 --group_reporting --name=mytest --ramp_time=60 --runtime=${runt1} --time_based --numjobs=${jobs1} --iodepth=${QD1} --filename=/dev/"$DEV" --rw=${WL1} --rwmixread=70 --bs=${block1} --output="$DEV"_${block1}_${WL1}_${jobs1}_${QD1}.log --log_avg_msec=1000 --write_iops_log="$DEV"_${block1}_${WL1}_${jobs1}_${QD1}_iops --write_lat_log="$DEV"_${block1}_${WL1}_${jobs1}_${QD1}_latdonedonedonedone
done

4.数据分析

顺序读、顺序写主要看BW,随机读、随机写主要看IOPS.
1)怎么看lat分布?

bw (KB  /s): min=   71, max=  251, per=0.36%, avg=154.84, stdev=18.29lat (usec) :   2= 0.01%,   4=0.01%,  10=0.01%,   20=0.01%, 50=51.41%lat (usec) : 100=48.53%, 250=0.06%, 500=0.01%, 1000=0.01%lat (msec) :   2= 0.01%,   4=0.01%,  10=0.01%,   20=0.01%

这组数据表示latency的分布,说明了51.41%的request延迟小于50微秒,48.53%的延迟小于100微秒(但是大于50微秒),以此类推
其他待续:
参考:https://blog.csdn.net/feilianbb/article/details/50497845

2)fio log收集
请参考<利用Python3.4+收集fio测试结果>
https://blog.csdn.net/weixin_40343504/article/details/97886537

5.fio常用参数详解

a.loops=int
重复运行某个job多次,默认是1。
loops与runtime是两个不能同时存在的两个参数,loops主要是定义硬盘执行的圈数,而runtime只是定义fio执行的时间。
b.time_based
如果设置的话,即使file已被完全读写或写完,也要执行完runtime规定的时间。它是通过循环执行相同的负载来实现的,与runtime相对应。
c.ramp_time=time
设定在记录任何性能信息之前要运行特定负载的时间。这个用来等性能稳定后,再记录日志结果,因此可以减少生成稳定的结果需要的运行时间。
d.randrepeat=bool
对于随机IO负载,配置生成器的种子,使得路径是可以预估的,使得每次重复执行生成的序列是一样的。

如果无–randrepeat=0这个参数不会影响seqread,但会影响seqwrite,randwrite,randread.

在这里插入图片描述
e.norandommap
一般情况下,fio在做随机IO时,将会覆盖文件的每一个block.如果这个选项设置的话,fio将只是获取一个新的随机offset,而不会查询过去的历史。这意味着一些块可能没有读或写,一些块可能要读/写很多次。在个选项与verify=互斥,并只有多个块大小(bsrange=)正在使用,因为fio只会记录完整的块的重写。
f.thread
fio默认会使用fork()创建job,如果这个选项设置的话,fio将使用pthread_create来创建线程。
在这里插入图片描述
g.direct=bool
direct=1 测试过程绕过机器自带的buffer。使测试结果更真实。
h.group_reporting
如果‘numjobs’设置的话,我们感兴趣的可能是打印group的统计值,而不是一个单独的job。这在‘numjobs’的值很大时,一般是设置为true的,可以减少输出的信息量。如果‘group_reporting’设置的话,fio将会显示最终的per-groupreport而不是每一个job都会显示。
i.numjobs=int
创建特定数目的job副本。可能是创建大量的线程/进程来执行同一件事。我们将这样一系列的job,看作一个特定的group。

参考:https://www.itzhoulin.com/2015/12/24/fio-man-guide/


http://chatgpt.dhexx.cn/article/d23YrFm9.shtml

相关文章

FIO 存储性能压测

一、 FIO简介 FIO 是一个多线程IO生成工具&#xff0c;可以生成多种IO模式&#xff08;随机、顺序、读、写四大类&#xff09;&#xff0c;用来测试磁盘设备的性能。GFIO是FIO的图形监测工具&#xff0c;它提供了图形界面的参数配置&#xff0c;和性能监测图像。 在github上的…

磁盘性能测试工具-FIO的安装及使用

文章目录 FIO介绍FIO安装在线安装离线安装 磁盘测试命令行方式测试结果说明命令参数说明配置文件方式 dd命令介绍使用方法 FIO介绍 FIO是一款测试IOPS的工具&#xff0c;用于对磁盘进行压力测试和验证&#xff0c;磁盘I/O是检查磁盘性能的重要指标&#xff0c;可以按照负载情况…

NuGet学习笔记(1)——初识NuGet及快速安装使用

http://kb.cnblogs.com/page/143190/ 1. NuGet是什么&#xff1f; NuGet is a Visual Studio 2010 extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. This topic lists documentation t…

Nuget路径问题

VS NetGet包管理器 问题场景&#xff1a; 装了两遍VS2019,第一次装D盘卸载了&#xff0c;然后装C盘&#xff0c;结果生成 .netCore项目时就悲剧了&#xff0c;报错&#xff1a;error MSB4018: “ResolvePackageAssets”任务意外失败。Microsoft.PackageDependencyResolution.t…

使用nuget 打包并上传 nuget.org

使用nuget 打包并上传 nuget.org 一、准备工作二、打包你的项目三、上传 nug.org 服务器 前言&#xff1a;今天又玩了个新东西&#xff0c;那就是 使用nuget 打包并上传 nuget.org&#xff0c;在这里即时记录一下&#xff0c;废话不多说&#xff0c;直接上教程。 一、准备工作…

nuget 的生成、发布、使用和更新

nuget 的生成、发布、使用和更新 一、nuget 的生成1.生成.dll1.1创建.net项目&#xff08;类库&#xff09;1.2 打包生成 .dll 2.打包成.nupkg文件2.1安装 [NuGetPackageExplorer.exe](https://github.com/NuGetPackageExplorer/NuGetPackageExplorer)程序2.2打开软件,完成打包…

修改NuGet包默认存放位置

默认情况下&#xff0c;NuGet下载的包存放在系统盘(C盘中)&#xff0c;这样一来&#xff0c;时间长了下载的包越多&#xff0c;C盘占用的空间也就越多。 1、问题描述 默认情况下&#xff0c;NuGet下载的包存放在系统盘(C盘中&#xff0c;一般在路径C:\Users\用户\.nuget\packag…

Nuget使用简介

1.什么是Nuget Nuget是 ASP .NET Gallery 的一员。NuGet 是免费、开源的包管理开发工具&#xff0c;专注于在 .NET 应用开发过程中&#xff0c;简单地合并第三方的组件库。 当需要分享开发的工具或是库&#xff0c;需要建立一个Nuget package&#xff0c;然后把这个package放到…

Nuget的使用说明

在做项目的时候&#xff0c;经常需要添加一些第三方引用&#xff0c;Visual Studio 2019环境下&#xff0c;最推荐的是Nuget安装方式&#xff0c;好处就是可以将所有依赖的包全部打包下载安装。 1.nuget.org&#xff0c;搜索需要的nuget包&#xff0c;复制相应的安装命令&…

NuGet的了解

目录 1..NuGet 的使用目的 2..Net 的工具 NuGet 1.NuGet 包的下载 2.NuGet 包的分析 3.NuGet 的使用 1.通过命令行使用 2.在 visual studio 里通过图形化界面进行添加。 3.在添加包的时候 4.特点 1..NuGet 的使用目的 在引入第三方程序集&#xff08;dll&#xff09;的…

初识NuGet - 概念, 安装和使用

1. NuGet是什么&#xff1f; NuGet is a Visual Studio 2010 extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. This topic lists documentation that will help you use NuGet packages…

NuGet的介绍及使用

介绍 NuGet是什么&#xff1f; NuGet是.NET的软件包管理器。NuGet客户端工具提供了生成和使用软件包的功能。NuGet 是所有软件包作者和使用者都使用的中央软件包存储库。 下面是百度百科的介绍 在我看来NuGet类似于Java的Maven和Javascript的npm。 使用 1、通过图形化客户端安…

NuGet包介绍

前言 什么是NuGet&#xff1f; NuGet是.NET的软件包管理器。NuGet客户端工具提供了生成和使用软件包的功能。NuGet Gallery是所有软件包作者和使用者都使用的中央软件包存储库。 包的安装和卸载 (以Newtonsoft.Json举例) 1.控制台 安装&#xff1a;Install-Package Newtonsoft…

NuGet使用

1.创建类库方法 2.双击项目配置 <Project Sdk"Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>net6.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><!--以下是…

NuGet学习

NuGet学习 文章目录 NuGet学习1.简介2.Visual Studio安装3.安装包3.1 打开NuGet3.2 搜索安装包 4.使用包 1.简介 NuGet包是一个zip文件&#xff0c;其中包含程序集&#xff08;或多个程序集&#xff09;、配置信息和PowerShell脚本。NuGet包可以从微软找到&#xff0c;也可以从…

什么是nuget?nuget包是如何管理

做windows开发的&#xff0c;迟早会接触到nuget这个东西&#xff0c;那么今天我们就来研究一下什么是nuget&#xff1f; 我们先从另外一些大家熟悉的概念入手&#xff0c;做linux的大家应该应该听说过apt-get&#xff0c;yum&#xff0c;deb等等&#xff0c;是的这些都是包管理…

NuGet包管理器

在.NET应用程序编程开发中&#xff0c;开发者通常使用类库来管理、维护属于同一分类的程序代码&#xff0c;以便代码的重用。一般情况下&#xff0c;处于同一类库的所有类都位于同一程序集。 这些类库被编译器编译后会生成扩展名为.dll的动态链接库文件&#xff0c;你可以在其…

VS Nuget的使用

目录 VS Nuget的使用 一、引言 二、认识Nuget 三、如何使用Nuget 1.常规使用 2.安装类库的历史版本 3.常见问题 4.离线安装nuget包 VS Nuget的使用 一、引言 最古老的时候我们想引用一个第三方类库&#xff0c;方法就是先下载第三方的dll文件&#xff0c;然后放置到我…

nuget使用教程

1.打开文件夹 E:\工具\PackageExplorer.4.4.72 双击 NyGetPackageExplorer.exe 文件。 2.点击Open a package from online feed 得到右图&#xff0c;输入自己的package source&#xff1b;选中自己要升级的nuget包&#xff0c;双击。 √ > File > Publish

NuGet安装使用

一.NuGet 1.介绍 在.NET应用程序编程开发中&#xff0c;开发者通常使用类库来管理、维护属于同一分类的程序代码&#xff0c;以便代码的重用。一般情况下&#xff0c;处于同一类库的所有类都位于同一程序集。 这些类库被编译器编译后会生成扩展名为.dll的动态链接库文件&…