简介:

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性能的更多相关文章

  1. [记录]FIO测试磁盘iops性能

    FIO测试磁盘iops性能 1.SATA和SAS盘原生IOPS如下: 2.RAID磁盘阵列对应的写惩罚级别: 3.计算功能性IOPS公式如下: 功能性 IOPS=(((总原生 IOPS×写 %))/( ...

  2. linux使用FIO测试磁盘的iops 【转载】

     linux使用FIO测试磁盘的iops 2013-09-23 10:59:21 分类: LINUX FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括 ...

  3. vdbench和fio测试磁盘性能的对比总结

    一.安装 1.安装vdbench,首先安装java:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-213 ...

  4. fio 测试磁盘

    root@rook-test:/# ceph osd status+----+-----------------------------+-------+-------+--------+------ ...

  5. fio 测试磁盘性能

    在磁盘测试中最关心的几个指标分别为: iops(每秒执行的IO次数).bw(带宽,每秒的吞吐量).lat(每次IO操作的延迟). 当每次IO操作的block较小时,如512bytes/4k/8k等,测 ...

  6. CentOS中使用FIO测试磁盘IO性能

    $ yum install fio 0x02 命令 随机读: $ fio -filename=/dev/sda1 -direct=1 -iodepth 1 -thread -rw=randread - ...

  7. FIO 测试磁盘iops 以及读写

    最近在做mariadb的性能,感觉io 有瓶颈,就使用fio 来测试一下磁盘.下文为转载文章(温馨提示:此命令很伤硬盘,测试前请备份数据,- -我就写坏了一个.) FIO 是测试IOPS的非常好的工具 ...

  8. 使用FIO测试磁盘iops

    我们如何衡量一个存储的性能呢?IOPS(Input/Output OperationsPer Second),即每秒进行读写(I/O)操作的次数是国际上通用的存储性能衡量标准,IOPS越高意味着在同一 ...

  9. linux 使用FIO测试磁盘iops 方法详解

    FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎, 包括:sync,mmap, libaio, posixaio, SG v3, splice, null, ...

随机推荐

  1. Oracle更新表字段时内容中含有特殊字符&的解决方法

    今天在做 Oracle表字段更新时出现了特殊字符&,导致无法更新. 这个问题是第二次碰到了,所以在此记录下,以备后用. 举例: update t set col1='A&B' wher ...

  2. Tensorflow版Faster RCNN源码解析(TFFRCNN) (2)推断(测试)过程不使用RPN时代码运行流程

    本blog为github上CharlesShang/TFFRCNN版源码解析系列代码笔记第二篇   推断(测试)过程不使用RPN时代码运行流程 作者:Jiang Wu  原文见:https://hom ...

  3. 架构演进历程及为什么选择Spring Cloud

    单体式架构: 垂直拆分: 垂直拆分的特点: 分布式服务: 分布式服务的特点: SOA面向服务的架构: 服务治理: 微服务: 微服务结构: 服务调用方式: http客户端工具:

  4. 洛谷P2062 分队问题(dp)

    题意 题目链接 给定n个选手,将他们分成若干只队伍.其中第i个选手要求自己所属的队伍的人数大等于a[i]人. 在满足所有选手的要求的前提下,最大化队伍的总数. 注:每个选手属于且仅属于一支队伍. So ...

  5. 高效的设计可视化UI

    http://www.uimaker.com/uimakerdown/uitutorial/35990.html http://maqetta.org/downloads/ .Data.js Data ...

  6. 关于dataTable 生成JSON 树

    背景: POSTGRESL + C#  + DHTMLX SUIT 一个表生成一个JSON串,这个不是很麻烦: 1.在数据库(postges)中:  json_agg(row_to_json(t)) ...

  7. ABAP EXCEPTION

    CX_ROOT | |--CX_STATIC_CHECK | |--CX_DYNAMIC_CHECK | | | |--CX_SY_ARITHMETIC_ERROR //运算 '&OPERAT ...

  8. Kendo DataSource 概述

    Kendo DataSource 概述 Kendo 的数据源支持本地数据源( JavaScript 对象数组),或者远程数据源(XML, JSON, JSONP),支持 CRUD 操作(创建,读取,更 ...

  9. Nmap安全扫描程序

    Nmap安全扫描程序 下载地址:https://nmap.org/download.html#windows 参考手册:https://nmap.org/man/zh/index.html#man-d ...

  10. css3动画之圆形运动轨迹

    css3中通过@keyframes定义动画,animation设置动画属性,从而实现动画效果: 在animation属性当中,可以规定动画的名称.整个动画的运行时间.运动的速度曲线以及其延迟时间.播放 ...