IO性能测试工具使用

测试指标:

IOPS :每秒读写操作(I/O)的次数
Throughput:带宽,一般用MBPS,每秒传输的MB字节数来衡量
Latency:访问延时,完成一次i/o请求所需时间

Fio工具使用

参数 说明

filename=/dev/sda  磁盘路径,不能为文件夹路径

direct direct=1 表示测试的 IO 用直接 IO,即跳过文件系统高速缓存, 使测试结果更接近磁盘性能

iodepth IO 队列长度,典型值: 64 或 128, 值越大磁盘的 IO 负载越高,同时 IO 延迟也会增大,iodepth=1 用来测 IO 延迟

ioengine 设置 IO 引擎, 决定 fio 调用哪种 IO 库,通常用 libaio

rw IO 类型:read = 顺序读,write = 顺序写,randread = 随机读,randwrite = 随机写…

bs IO 块大小,即每个 IO 读写的数据量,通常 bs=1M 用于测试顺序读写带宽,bs=4K 用于测试随机读写的 IOPS

size IO 读写数据总量,如果 runtime 参数设置的时间到,则会停止

numjobs 同时读写的子进程数

runtime 读写时长,如果读写完 size 参数设置的数据量后还未到读写时长且没有设置 time_based 选项,则停止

name 本次测试任务的名字

Fio参数解释:

随机读:
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest


顺序写:
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest


随机写:
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=1000 -group_reporting -name=mytest


混合随机读写:
fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=100 -group_reporting -name=mytest -ioscheduler=noop



测试混合随机读写:
[root@Dell]# fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=200G -numjobs=30 -runtime=100 -group_reporting -name=mytest1

注意事项:

1.写操作时不要对有数据的盘进行测试会破坏数据

2.写操作时size值不要超过磁盘最大容量,会导致机器挂掉

3.命令参数之间要用空格分隔,有时网络复制命令可能会出错,较难发现异常

实例:

fio -filename=/dev/sda -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=70 -ioengine=psync -bs=16k -size=10G -numjobs=5 -runtime=200 -group_reporting -name=mytest -ioscheduler=noop

混合读写输出:

Starting 5 threads

Jobs: 5 (f=5): [m(5)][100.0%][r=1666KiB/s,w=698KiB/s][r=104,w=43 IOPS][eta 00m:00s] 

mytest: (groupid=0, jobs=5): err= 0: pid=18019: Thu Jan 24 21:49:27 2019

   read: IOPS=215, BW=3448KiB/s (3531kB/s)(674MiB/200136msec)

    clat (usec): min=53, max=1542.9k, avg=19892.64, stdev=50617.29

     lat (usec): min=53, max=1542.9k, avg=19893.33, stdev=50617.28

    clat percentiles (usec):

     |  1.00th=[    57],  5.00th=[    71], 10.00th=[   101], 20.00th=[   119],

     | 30.00th=[   135], 40.00th=[   147], 50.00th=[   172], 60.00th=[  3556],

     | 70.00th=[ 15926], 80.00th=[ 30016], 90.00th=[ 58459], 95.00th=[ 89654],

     | 99.00th=[206570], 99.50th=[295699], 99.90th=[666895], 99.95th=[817890],

     | 99.99th=[977273]

   bw (  KiB/s): min=    5, max= 2139, per=19.24%, avg=663.32, stdev=428.31, samples=1926

   iops        : min=    0, max=  133, avg=41.01, stdev=26.77, samples=1926

  write: IOPS=93, BW=1496KiB/s (1532kB/s)(292MiB/200136msec)

    clat (usec): min=456, max=1050.0k, avg=7571.94, stdev=33210.46

     lat (usec): min=457, max=1050.0k, avg=7573.59, stdev=33210.50

    clat percentiles (usec):

     |  1.00th=[   570],  5.00th=[   627], 10.00th=[   685], 20.00th=[  1057],

     | 30.00th=[  1516], 40.00th=[  1680], 50.00th=[  1958], 60.00th=[  2376],

     | 70.00th=[  2835], 80.00th=[  3916], 90.00th=[  9241], 95.00th=[ 28181],

     | 99.00th=[127402], 99.50th=[219153], 99.90th=[446694], 99.95th=[666895],

     | 99.99th=[926942]

   bw (  KiB/s): min=    5, max= 1080, per=20.00%, avg=299.20, stdev=206.41, samples=1854

   iops        : min=    0, max=   67, avg=18.26, stdev=12.91, samples=1854

  lat (usec)   : 100=6.87%, 250=32.98%, 500=1.42%, 750=4.39%, 1000=1.69%

  lat (msec)   : 2=9.85%, 4=9.12%, 10=5.90%, 20=7.47%, 50=11.06%

  lat (msec)   : 100=6.04%, 250=2.63%, 500=0.44%, 750=0.07%, 1000=0.06%

  lat (msec)   : 2000=0.01%

  cpu          : usr=0.05%, sys=7.02%, ctx=32168, majf=0, minf=4

  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%

     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%

     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%

     issued rwt: total=43133,18713,0, short=0,0,0, dropped=0,0,0

     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):

   READ: bw=3448KiB/s (3531kB/s), 3448KiB/s-3448KiB/s (3531kB/s-3531kB/s), io=674MiB (707MB), run=200136-200136msec

  WRITE: bw=1496KiB/s (1532kB/s), 1496KiB/s-1496KiB/s (1532kB/s-1532kB/s), io=292MiB (307MB), run=200136-200136msec

Disk stats (read/write):

  sda: ios=43596/18740, merge=537/5, ticks=915366/105750, in_queue=1021774, util=99.95%

部分输入参数对iops影响:

  1. iodepth:队列深度,加大队列深度表示让硬盘不断工作,减少硬盘空闲时间;

加大队列深度-》提高利用率-》获得ipos和mbps峰值-》响应时间增加

2.size:寻址空间,寻址空间较小时iops会显著提高,因为寻址空间小时磁头需要移动的距离变小,每次io请求服务时间降低。要测试整盘性能所以寻址空间设置过小意义不大

Fio输出字段说明

## Jobs: 1表示运行的IO线程数; [w(1)]表示使用模式, w为随机写; [100.0% done]表示当前进程执行的进度; [0KB/2092KB/0KB /s]表示吞吐率瞬时值; [0/523/0 iops]表示IOPS瞬时值; [eta 00m:00s]表示持续时间;命令执行期间,可看到值在实时变化 
Jobs: 1 (f=1): [w(1)] [100.0% done] [0KB/47784KB/0KB /s] [0/11.1K/0 iops] [eta 00m:00s]

## 分别表示任务名称: (当前的GID, job个数): 错误个数; job对应的PID, 任务结束时间 
KingStack EBS 4K randwrite test: (groupid=0, jobs=1): err= 0: pid=5424: Wed Jul 26 15:21:26 2017

## 输出结果: 模式为write, io大小为2794.3MB, 吞吐率为 47687KB/s, IOPS为11921, 执行时间为60s 
write: io=2794.3MB, bw=47687KB/s, iops=11921, runt= 60003msec

## 提交响应时间 
slat (usec): min=1, max=1550, avg= 4.95, stdev= 8.24

## 完成响应时间=提交时间+完成时间(avg较为重要) 
clat (usec): min=27, max=25162, avg=1335.00, stdev=1015.81

## 响应时间 
lat (usec): min=137, max=25166, avg=1340.28, stdev=1015.86

## 95.00th=[ 3440]: 表示95%的IO请求的响应时间小于等于3.44s clat percentiles (usec): | 1.00th=[ 247], 5.00th=[ 306], 10.00th=[ 354], 20.00th=[ 442], | 30.00th=[ 524], 40.00th=[ 660], 50.00th=[ 964], 60.00th=[ 1464], | 70.00th=[ 1704], 80.00th=[ 2192], 90.00th=[ 2928], 95.00th=[ 3440], | 99.00th=[ 3696], 99.50th=[ 3760], 99.90th=[ 4080], 99.95th=[ 4384], | 99.99th=[ 9536]

## 带宽情况 
bw (KB /s): min=45333, max=55131, per=100.00%, avg=47722.74, stdev=1267.38

## Request延迟情况 
lat (usec) : 50=0.01%, 100=0.01%, 250=1.12%, 500=25.93%, 750=16.29% lat (usec) : 1000=7.43% lat (msec) : 2=24.02%, 4=25.09%, 10=0.12%, 20=0.01%, 50=0.01%

## cpu使用率 
cpu : usr=3.13%, sys=8.57%, ctx=86552, majf=0, minf=6

## IO队列深度分布 
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%

## 每次IO需要提交的IO个数 
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%

## 每次IO完成的IO个数 
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%

## 执行的读写IO操作的情况 
issued : total=r=0/w=715339/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0

## IO完成延迟的分布情况 
latency : target=0, window=0, percentile=100.00%, depth=16

## IO操作情况汇总: 全部IO大小, group总带宽, 最小平均带宽, 最大平均带宽, group中的最短线程运行时间, group中的最长线程运行时间 
Run status group 0 (all jobs): 
WRITE: io=2794.3MB, aggrb=47686KB/s, minb=47686KB/s, maxb=47686KB/s, mint=60003msec, maxt=60003msec

## 所有group总共执行的IO情况: IO数量, IO合并情况, 表示磁盘繁忙的tick数量, 队列消耗时间, 磁盘使用率 
Disk stats (read/write): 
vdb: ios=59/714790, merge=0/0, ticks=28/915069, in_queue=914950, util=99.52%

  • 3
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Linux系统中,有多个工具可以用于测试IO性能,以下是其中一些常用的工具: 1. **dd命令**:`dd`是一个常用的Linux命令,可以用于复制文件和块设备,也可以用于测试IO性能。可以使用`dd`命令来生成一个特定大小的文件,同时记录复制过程的时间,计算出数据传输的速度。例如,`dd if=/dev/zero of=testfile bs=1M count=1000 conv=fdatasync`将创建一个名为testfile的1GB文件,并记录数据传输速度。在使用`dd`时,请注意选择正确的块大小以获得最佳性能。 2. **fio工具**:`fio`是一个用于测试磁盘性能的工具,可以模拟不同的IO负载和场景。它可以测试各种IO引擎和文件系统,并生成详细的报告。`fio`支持多线程、异步IO和随机IO等,可以根据需要进行配置。例如,`fio --name=randwrite --ioengine=libaio --rw=randwrite --bs=4k --numjobs=8 --size=2G --runtime=300 --time_based`将测试8个进程在2GB的文件上进行随机写入,每个进程使用4KB块大小,运行时间为300秒。 3. **bonnie++工具**:`bonnie++`是一个基于文件系统的基准测试工具,可测试文件的创建、删除、读取和写入等操作的性能。`bonnie++`支持多线程和随机IO等,并可以生成详细的报告。例如,`bonnie++ -d /path/to/test/dir -s 2048 -r 1024`将在指定目录中测试2GB文件的创建、读取和写入,使用1KB块大小进行随机读写,同时记录操作的时间并计算数据传输速度。 4. **iozone工具**:`iozone`是另一个常用的基准测试工具,可测试文件和文件系统的IO性能。它可以测试顺序读取、顺序写入、随机读取、随机写入等操作,并支持多线程和异步IO等。例如,`iozone -a -i 0 -i 1 -i 2 -s 1G -r 4k -t 32`将测试1GB文件的顺序读写和随机读写,每次读写使用4KB块大小,并使用32个线程进行测试。 以上这些工具都可以用于测试IO性能,但在使用它们时需要了解自己的测试需求和测试环境,选择合适的工具和参数进行测试。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值