使用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, ...
随机推荐
- Spark Mllib里如何对决策树二元分类和决策树多元分类的分类数目numClasses控制(图文详解)
不多说,直接上干货! 决策树二元分类的分类数目numClasses控制 具体,见 Hadoop+Spark大数据巨量分析与机器学习整合开发实战的第13章 使用决策树二元分类算法来预测分类Stumble ...
- 远程调试工具weinre使用教程
一:前言 我们都知道,chrome的开发者工具(f12)是一个方便我们调试PC页面的工具.但是现在我们的开发离不开移动端,那如果我们需要对手机页面进行调试,那该怎么办了? 当然,chrome的开发者工 ...
- SyntaxError: Use of const in strict mode.
具体报错console c:\Users\Administrator\WebstormProjects\blogtest\node_modules\connect-mongo\src\index.js ...
- Java基础:(二)String字符串
一.String概述 String被声明为final,因为它不可被继承. 内部使用char数组存储数据,该数组被声明为final,这意味着value数组初始化之后就不能再引用其他数组.并且String ...
- 关于rabbitmq的消息路由的同步问题
http://www.cnblogs.com/me-sa/archive/2012/11/12/rabbitmq_ram_or_disk_node.html我是看了上面的博客明白了一些原理的,我之前一 ...
- 四道java语言练习基础题:
一.==符的使 首先看一段比较有意思的代码 Integer a = 1000,b=1000; Integer c = 100,d=100; public void mRun(final String ...
- java object默认的基本方法
java object默认的基本方法中没有copy(),含有如下9个方法: getClass(), hashCode(), equals(), clone(), toString(), notify ...
- 中国各运营商(电信、联通、移动、铁通)IP地址段
除此电信.联通.移动.铁通之外还有教育网.科技网.广电.长城.广电…… 表格下载: http://files.cnblogs.com/files/xiaohi/中国IP网段.zip 以上资料参考: h ...
- Android(java)学习笔记110:Java中操作文件的类介绍(File + IO流)
1.File类:对硬盘上的文件和目录进行操作的类. File类是文件和目录路径名抽象表现形式 构造函数: 1) File(String pathname) Creat ...
- 用python Image读图
https://www.cnblogs.com/kongzhagen/p/6295925.html import os name = [] with open('/media/hdc/xing/Dee ...