使用fio测试磁盘I/O性能
简介:
fio是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。
安装fio:
官网网站:http://brick.kernel.dk/snaps/
wget http://brick.kernel.dk/snaps/fio-2.2.10.tar.gz (从官网下载fio的tar包)
tar -zxvf fio-2.2..tar.gz (解压)
cd fio-2.2.
make && make install (安装)
yum install libaio-devel (为了支持同步I/O)
fio分随机读,随机写,顺序读,顺序写,混合随机读写模式。
fio参数:
filename=/dev/sdb #测试文件(设备)的名称,通常选择需要测试的data目录(可以通过冒号分割同时指定多个文件,如filename=/dev/sda:/dev/sdb。) direct= #测试过程绕过机器自带的buffer(缓冲区),使测试结果更真实 rw=randwrite · #测试随机写的I/O rw=randread #测试随机读的I/O rw=randrw #测试随机读写的I/O bs=4k #单次I/O的块文件大小为4K size=20G #本次测试的文件大小为20G,以每次4K的I/O进行测试 numjobs= #本次的测试线程为30个 runtime= #测试时间为600秒,如果不写,则一直将20G文件分每次4K写完为止 ioengine=psync #I/O引擎使用psync方式(I/O引擎,现在fio支持19种ioengine。默认值是sync同步阻塞I/O,libaio是Linux的native异步I/O。关于同步异步,阻塞和非阻塞模型可以参考文章“使用异步 I/O 大大提高应用程序的性能”。
http://www.ibm.com/developerworks/cn/linux/l-async/) group_reporting #关于显示结果的,汇总每个进程的信息 name #指定job的名字,在命令行中表示新启动一个job。 iodepth #如果ioengine采用异步方式,该参数表示一批提交保持的io单元数。(该参数可参考文章“Fio压测工具和io队列深度理解和误区”。http://blog.yufeng.info/archives/2104) thread #线程
fio实例:
随机读4K: fio -filename=/dev/sdb:/dev/sdc:/dev/sdd -direct= -iodepth= -thread -rw=randread -ioengine=libaio -bs=4k -size=20G -numjobs= -runtime= -group_reporting -name=mytest 随机写4K: fio -filename=/dev/sdb:/dev/sdc:/dev/sdd -direct= -iodepth= -thread -rw=randwrite -ioengine=libaio -bs=4k -size=20G -numjobs= -runtime= -group_reporting -name=mytest 顺序读1M: fio -filename=/dev/sdb:/dev/sdc:/dev/sdd -direct= -iodepth= -thread -rw=read -ioengine=libaio -bs=1M -size=20G -numjobs= -runtime= -group_reporting -name=mytest 顺序写1M: fio -filename=/dev/sdb:/dev/sdc:/dev/sdd -direct= -iodepth= -thread -rw=write -ioengine=libaio -bs=1M -size=20G -numjobs= -runtime= -group_reporting -name=mytest 混合随机读写: fio -filename=/dev/sdb:/dev/sdc:/dev/sdd -direct= -iodepth -thread -rw=randrw -rwmixread= -ioengine=psync -bs=16k -size=200G -numjobs= -runtime= -group_reporting -name=mytest -ioscheduler=noop
实例测试:
注:主要关注结果用橙色标出
4k随机读:
[root@localhost ~]# fio -filename=/dev/sda:/dev/sdb:/dev/sdc -direct= -iodepth -thread -rw=randread -ioengine=libaio -bs=4k -size=20G -numjobs= -runtime= -group_reporting -name=mytest
mytest: (g=): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=
...
fio-2.21
Starting threads
Jobs: (f=): [r()][100.0%][r=.2MiB/s,w=0KiB/s][r=,w= IOPS][eta 00m:00s]
mytest: (groupid=, jobs=): err= : pid=: Thu Jun ::
read: IOPS=, BW=.8MiB/s (.3MB/s)(1077MiB/100033msec)
slat (usec): min=, max=, avg=21.55, stdev= 9.74
clat (usec): min=, max=, avg=10853.67, stdev=12909.46
lat (usec): min=, max=, avg=10875.94, stdev=12909.57
clat percentiles (usec):
| .00th=[ ], .00th=[ ], .00th=[ ], .00th=[ ],
| .00th=[ ], .00th=[ ], .00th=[ ], .00th=[],
| .00th=[], .00th=[], .00th=[], .00th=[],
| .00th=[], .50th=[], .90th=[], .95th=[],
| .99th=[]
bw ( KiB/s): min= , max= , per=0.00%, avg=369.92, stdev=100.81
lat (usec) : =0.11%, =0.12%, =0.27%
lat (msec) : =2.59%, =9.55%, =43.26%, =37.74%, =5.51%
lat (msec) : =0.63%, =0.20%, =0.01%, =0.01%
cpu : usr=0.09%, sys=0.32%, ctx=, majf=, minf=
IO depths : =100.0%, =0.0%, =0.0%, =0.0%, =0.0%, =0.0%, >==0.0%
submit : =0.0%, =100.0%, =0.0%, =0.0%, =0.0%, =0.0%, >==0.0%
complete : =0.0%, =100.0%, =0.0%, =0.0%, =0.0%, =0.0%, >==0.0%
issued rwt: total=,,, short=,,, dropped=,,
latency : target=, window=, percentile=100.00%, depth= Run status group (all jobs):
READ: bw=.8MiB/s (.3MB/s), .8MiB/s-.8MiB/s (.3MB/s-.3MB/s), io=1077MiB (1129MB), run=-100033msec Disk stats (read/write):
sda: ios=/, merge=/, ticks=/, in_queue=, util=92.52%
sdb: ios=/, merge=/, ticks=/, in_queue=, util=84.34%
sdc: ios=/, merge=/, ticks=/, in_queue=, util=91.21%
混合随机读写:
[root@localhost ~]# fio -filename=/dev/sda:/dev/sdb:/dev/sdc -direct= -iodepth -thread -rw=randrw -ioengine=libaio -bs=4k -size=20G -numjobs= -runtime= -group_reporting -name=mytest
mytest: (g=): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=
...
fio-2.21
Starting threads
Jobs: (f=): [m()][100.0%][r=404KiB/s,w=464KiB/s][r=,w= IOPS][eta 00m:00s]
mytest: (groupid=, jobs=): err= : pid=: Thu Jun ::
read: IOPS=, BW=345KiB/s (353kB/s)(.7MiB/100117msec)
slat (usec): min=, max=, avg=30.70, stdev=11.21
clat (usec): min=, max=, avg=50031.54, stdev=79240.40
lat (usec): min=, max=, avg=50063.31, stdev=79240.09
clat percentiles (usec):
| .00th=[ ], .00th=[ ], .00th=[ ], .00th=[ ],
| .00th=[ ], .00th=[ ], .00th=[], .00th=[],
| .00th=[], .00th=[], .00th=[], .00th=[],
| .00th=[], .50th=[], .90th=[], .95th=[],
| .99th=[]
bw ( KiB/s): min= , max= , per=0.01%, avg=18.68, stdev=12.27
write: IOPS=, BW=344KiB/s (352kB/s)(.6MiB/100117msec)
slat (usec): min=, max=, avg=34.27, stdev=15.34
clat (msec): min=, max=, avg=297.95, stdev=232.05
lat (msec): min=, max=, avg=297.99, stdev=232.05
clat percentiles (msec):
| .00th=[ ], .00th=[ ], .00th=[ ], .00th=[ ],
| .00th=[ ], .00th=[ ], .00th=[ ], .00th=[ ],
| .00th=[ ], .00th=[ ], .00th=[ ], .00th=[ ],
| .00th=[ ], .50th=[ ], .90th=[ ], .95th=[ ],
| .99th=[ ]
bw ( KiB/s): min= , max= , per=0.00%, avg=13.50, stdev= 6.61
lat (usec) : =0.02%, =0.48%, =0.67%
lat (msec) : =5.84%, =5.92%, =10.74%, =7.24%, =9.34%
lat (msec) : =10.07%, =23.98%, =17.14%, =5.98%, =1.94%
lat (msec) : =0.64%
cpu : usr=0.01%, sys=0.03%, ctx=, majf=, minf=
IO depths : =100.0%, =0.0%, =0.0%, =0.0%, =0.0%, =0.0%, >==0.0%
submit : =0.0%, =100.0%, =0.0%, =0.0%, =0.0%, =0.0%, >==0.0%
complete : =0.0%, =100.0%, =0.0%, =0.0%, =0.0%, =0.0%, >==0.0%
issued rwt: total=,,, short=,,, dropped=,,
latency : target=, window=, percentile=100.00%, depth= Run status group (all jobs):
READ: bw=345KiB/s (353kB/s), 345KiB/s-345KiB/s (353kB/s-353kB/s), io=.7MiB (.4MB), run=-100117msec
WRITE: bw=344KiB/s (352kB/s), 344KiB/s-344KiB/s (352kB/s-352kB/s), io=.6MiB (.3MB), run=-100117msec Disk stats (read/write):
sda: ios=/, merge=/, ticks=/, in_queue=, util=100.00%
sdb: ios=/, merge=/, ticks=/, in_queue=, util=99.66%
sdc: ios=/, merge=/, ticks=/, in_queue=, util=99.90%
硬盘性能指标:
顺序读写 (吞吐量,常用单位为MB/s):文件在硬盘上存储位置是连续的。
适用场景:大文件拷贝(比如视频音乐)。速度即使很高,对数据库性能也没有参考价值。
4K随机读写 (IOPS,常用单位为次):在硬盘上随机位置读写数据,每次4KB。
适用场景:操作系统运行、软件运行、数据库。
使用fio测试磁盘I/O性能的更多相关文章
- [记录]FIO测试磁盘iops性能
FIO测试磁盘iops性能 1.SATA和SAS盘原生IOPS如下: 2.RAID磁盘阵列对应的写惩罚级别: 3.计算功能性IOPS公式如下: 功能性 IOPS=(((总原生 IOPS×写 %))/( ...
- linux使用FIO测试磁盘的iops 【转载】
linux使用FIO测试磁盘的iops 2013-09-23 10:59:21 分类: LINUX FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括 ...
- vdbench和fio测试磁盘性能的对比总结
一.安装 1.安装vdbench,首先安装java:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-213 ...
- fio 测试磁盘
root@rook-test:/# ceph osd status+----+-----------------------------+-------+-------+--------+------ ...
- fio 测试磁盘性能
在磁盘测试中最关心的几个指标分别为: iops(每秒执行的IO次数).bw(带宽,每秒的吞吐量).lat(每次IO操作的延迟). 当每次IO操作的block较小时,如512bytes/4k/8k等,测 ...
- CentOS中使用FIO测试磁盘IO性能
$ yum install fio 0x02 命令 随机读: $ fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randread - ...
- FIO 测试磁盘iops 以及读写
最近在做mariadb的性能,感觉io 有瓶颈,就使用fio 来测试一下磁盘.下文为转载文章(温馨提示:此命令很伤硬盘,测试前请备份数据,- -我就写坏了一个.) FIO 是测试IOPS的非常好的工具 ...
- 使用FIO测试磁盘iops
我们如何衡量一个存储的性能呢?IOPS(Input/Output OperationsPer Second),即每秒进行读写(I/O)操作的次数是国际上通用的存储性能衡量标准,IOPS越高意味着在同一 ...
- linux 使用FIO测试磁盘iops 方法详解
FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎, 包括:sync,mmap, libaio, posixaio, SG v3, splice, null, ...
随机推荐
- SmartWeatherAPI C#版
private string GetKey(string areaId, string type, string date, string appId, string privateKey) { va ...
- Ubuntu常用指令集
Ubuntu Linux 操作系统常用命令详细介绍 ( 1)Udo apt-get install 软件名 安装软件命令 sudo nautilus 打开文件(有 root 权限)su root 切换 ...
- 关于 hystrix 的异常 fallback method wasn't found
典型如下: @HystrixCommand(fallbackMethod = "fallbackHi") public String getHi(String x) { Strin ...
- [20190614]webpack+vue学习记录
本文记录一些学习webpack+vue相关的知识点,方便以后查阅,添加或修改 1. 初始化vue项目的代码结构 build--项目依赖包配置信息 config--项目配置文件 dev.env.js-- ...
- freebsd新添加磁盘
1.添加硬盘 2.查看现在的硬盘 3.执行sysinstall命令 4. 5. 6.按下enter键 7.A,C,Q 8. 9. 10.C,Q 11.newfs /dev/ad0 12.cd / &a ...
- IT圈网红,抢鲜围观
即将于2017年10月23-26日,在北京举办的微软技术暨生态大会,是微软中国年度最盛大的科技峰会,是微软技术大会与合作伙伴大会的首次联袂,也是聚集众多IT大咖的技术狂欢派对. 无论你想实现现代化工作 ...
- 在SharePoint Online或SharePoint本地列表中缺少功能区
您可能会遇到在SharePoint Online或SharePoint内部部署列表中看不到功能区的情况.功能区可以轻松访问SharePoint列表中的常见任务.它还提供了有用的工具,例如连接到Outl ...
- CentOS7.3+MySQL5.7+Apache2.4+PHP7.1+phpMyAdmin4.7+JDK1.8+SVN1.6+Jenkins2.1环境搭建
CentOS7.3+MySQL5.7+Apache2.4+PHP7.1+phpMyAdmin4.7+JDK1.8+SVN1.6+Jenkins2.1环境搭建 1.安装CentOS7.3虚拟机安装说明: ...
- Java 变量及基本数据类型
1.Java变量 1.1 变量的概念 内存中开辟的一块存储空间,用于存放运算过程中需要用到的数据: 该区域有自己的名称(变量名)和类型(数据类型): 该区域的数据可以在同一类型范围内不断变化: 1) ...
- 如何将SAP Multi Target应用部署到SAP云平台的Cloud Foundry环境去
SHINA是SAP HANA Interactive Education的缩写,是一个demo应用,用于演示如何开发SAP HANA原生应用. 这个应用包含了sample数据以及HANA数据库表,vi ...