使用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, ...
随机推荐
- spirngmvc整合mybatis
一.建立一张简单的User表 CREATE TABLE `users` (`id` int(20) NOT NULL AUTO_INCREMENT,`name` varchar(20) NOT NUL ...
- C#入门笔记3 表达式及运算符2
关系运算符,也称布尔比较运算符 注:var1为bool类型,var2与var3可以是其它类型.[数据类型看下一节] 运算符 类别 示例表达式 结果说明 == 二元 var1=var2==var3 如果 ...
- jsonp, json区别
JSONP由两部分组成: 回调函数和数据 回调函数是接收到响应时应该在页面中调用的函数,其名字一般在请求中指定. 数据是传入回调函数中的JSON数据. jsonp var script=documen ...
- vue-cli3项目优化首页加载过慢的一些心得
博主最近发现vue-cli3项目做完后,点击首页加载时间好久啊,一般都要3-5s.这样的加载时间博主自己都受不了,所以就有了这个随笔,将自己的一些研究心得分享给大家. 首先推荐大家下载一个webpac ...
- this的那点事
对于很多初学者,this总是搞得我们晕头转向. 现在,我就简单的总结一下关于this的那点事. this在函数定义时经常是不能确定的,只有在函数执行的时候才能最终确定this的归属.this总是指向最 ...
- PADS 创建封装笔记
1.在PADS logic中新建元件和CAE封装 2.在PADS layout 中建立元件的PCB封装 3.用PADS Library Converter 把以前版本的库转化为现在的版本.
- GreenDao的简单使用说明(五)多表n:m
在设计一些比较复杂的数据库结构的时候,我们会遇到表之间是n:m的关系,就是常说的多对多的关系,最常用的情况,就是用户权限这块,日常最常见的就是学生与老师的关系了,哪么我们来看一下GreenDao中如何 ...
- 内容导出成word
private void 导出word(string 内容) { string tit = "<html xmlns:v=\"urn:schemas-microsoft-co ...
- JAVA图形界面常用知识点总会《代码分析》
1. package CLASS16.bin.com.GridLayout; import javax.swing.ImageIcon;import javax.swing.JFrame;import ...
- MyEclipse7.0 M1下载和注册码
首先介绍下,这款MyEclipse7.0 M1已经内置了Eclipse3.4,所以无需再去下载. 1.下载地址: http://downloads.myeclipseide.com/downloads ...