目 录CONTENT

文章目录

IOPS

简中仙
2023-05-25 / 0 评论 / 0 点赞 / 51 阅读 / 0 字 / 正在检测是否收录...
温馨提示:
本文最后更新于2023-10-07,若内容或图片失效,请留言反馈。 本文如有错误或者侵权的地方,欢迎您批评指正!

一、IOPS 的基础知识

IOPS (Input/Output Per Second)即每秒的输入输出量(或读写次数),是衡量磁盘性能的主要指标之一。IOPS是指单位时间内系统能处理的I/O请求数量,一般以每秒处理的I/O请求数量为单位,I/O请求通常为读或写数据操作请求。

随机读写--IOPS,顺序读写--吞吐量

吞吐量=IOPS*读写块大小

IOPS=读写次数/任务整体时延

1、随机读写频繁的应用,如小文件存储(图片)、OLTP数据库、邮件服务器,关注随机读写性能,IOPS是关键衡量指标。

2、顺序读写频繁的应用,传输大量连续数据,如电视台的视频编辑,视频点播VOD(Video On Demand),关注连续读写性能。数据吞吐量是关键衡量指标**。**

IOPS和数据吞吐量适用于不同的场合,例如:读取10000个1KB文件,用时10秒 Throught(吞吐量)=1MB/s ,IOPS=1000,追求IOPS;读取1个10MB文件,用时0.2秒 Throught(吞吐量)=50MB/s, IOPS=5,追求吞吐量。

二、FIO 吞吐量和IOPS测试

# yum install -y libaio-devel fio

1、fio 常用参数

参数说明
filename指定文件(设备)的名称。可以通过冒号分割同时指定多个文件,如filename=/dev/sda:/dev/sdb
directory设置filename的路径前缀。在后面的基准测试中,采用这种方式来指定设备
name指定job的名字,在命令行中表示新启动一个job
directbool类型,如果设置成true (1),表示不使用io buffer
ioengineI/O引擎,现在fio支持19种ioengine。默认值是sync同步阻塞I/O,libaio是Linux的native异步I/O
iodepth如果ioengine采用异步方式,该参数表示一批提交保持的io单元数
rwI/O模式,随机读写,顺序读写等等
bsI/O block大小,默认是4k
size指定job处理的文件的大小
numjobs指定job的克隆数(线程)
time_based如果在runtime指定的时间还没到时文件就被读写完成,将继续重复知道runtime时间结束
runtime指定在多少秒后停止进程。如果未指定该参数,fio将执行至指定的文件读写完全完成
group_reporting当同时指定了numjobs了时,输出结果按组显示

2、随机读IOPS设置

# fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randread -bs=4K -size=1G -time_based -runtime=60 -name=Fio -directory=/mnt
Fio: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=128
fio-3.7
Starting 1 process
Fio: Laying out IO file (1 file / 1024MiB)
Jobs: 1 (f=1): [r(1)][100.0%][r=10.3MiB/s,w=0KiB/s][r=2626,w=0 IOPS][eta 00m:00s]
Fio: (groupid=0, jobs=1): err= 0: pid=24491: Wed Mar  1 17:38:38 2023
   read: IOPS=2619, BW=10.2MiB/s (10.7MB/s)(614MiB/60016msec)
    slat (usec): min=2, max=331, avg= 4.50, stdev= 3.04
    clat (usec): min=734, max=144782, avg=48862.19, stdev=45212.45
     lat (usec): min=739, max=144786, avg=48866.78, stdev=45212.29
    clat percentiles (msec):
     |  1.00th=[    5],  5.00th=[    5], 10.00th=[    5], 20.00th=[    5],
     | 30.00th=[    5], 40.00th=[    5], 50.00th=[    7], 60.00th=[   95],
     | 70.00th=[   95], 80.00th=[   95], 90.00th=[   95], 95.00th=[   96],
     | 99.00th=[   97], 99.50th=[   97], 99.90th=[  114], 99.95th=[  144],
     | 99.99th=[  144]
   bw (  KiB/s): min= 8384, max=12608, per=99.94%, avg=10470.70, stdev=333.52, samples=120
   iops        : min= 2096, max= 3152, avg=2617.65, stdev=83.38, samples=120
  lat (usec)   : 750=0.01%, 1000=0.01%
  lat (msec)   : 2=0.01%, 4=0.10%, 10=51.02%, 20=0.01%, 50=0.08%
  lat (msec)   : 100=48.58%, 250=0.20%
  cpu          : usr=0.46%, sys=1.81%, ctx=142720, majf=0, minf=162
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.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.1%
     issued rwts: total=157199,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=128

Run status group 0 (all jobs):
   READ: bw=10.2MiB/s (10.7MB/s), 10.2MiB/s-10.2MiB/s (10.7MB/s-10.7MB/s), io=614MiB (644MB), run=60016-60016msec

Disk stats (read/write):
  vda: ios=156809/545, merge=0/601, ticks=7657322/47717, in_queue=7705039, util=98.43%

单机预估值:2619

3、随机写IOPS设置

# fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randwrite -bs=4K -size=1G -time_based -runtime=60 -name=Fio -directory=/mnt
Fio: (g=0): rw=randwrite, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=libaio, iodepth=128
fio-3.7
Starting 1 process
Fio: Laying out IO file (1 file / 1024MiB)
Jobs: 1 (f=1): [w(1)][100.0%][r=0KiB/s,w=9384KiB/s][r=0,w=2346 IOPS][eta 00m:00s]
Fio: (groupid=0, jobs=1): err= 0: pid=27371: Wed Mar  1 17:41:35 2023
  write: IOPS=2315, BW=9261KiB/s (9483kB/s)(543MiB/60004msec)
    slat (usec): min=4, max=138566, avg=348.56, stdev=5175.06
    clat (usec): min=1744, max=194629, avg=54937.40, stdev=43297.56
     lat (usec): min=1755, max=194641, avg=55286.06, stdev=43257.43
    clat percentiles (msec):
     |  1.00th=[    4],  5.00th=[    6], 10.00th=[    7], 20.00th=[    8],
     | 30.00th=[    9], 40.00th=[   10], 50.00th=[   91], 60.00th=[   93],
     | 70.00th=[   94], 80.00th=[   94], 90.00th=[   95], 95.00th=[   96],
     | 99.00th=[   99], 99.50th=[  101], 99.90th=[  192], 99.95th=[  192],
     | 99.99th=[  194]
   bw (  KiB/s): min= 7744, max=11432, per=99.91%, avg=9251.98, stdev=382.30, samples=120
   iops        : min= 1936, max= 2858, avg=2312.99, stdev=95.57, samples=120
  lat (msec)   : 2=0.01%, 4=1.27%, 10=41.55%, 20=2.45%, 50=0.09%
  lat (msec)   : 100=54.06%, 250=0.57%
  cpu          : usr=0.37%, sys=2.43%, ctx=9165, majf=0, minf=30
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.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.1%
     issued rwts: total=0,138920,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=128

Run status group 0 (all jobs):
  WRITE: bw=9261KiB/s (9483kB/s), 9261KiB/s-9261KiB/s (9483kB/s-9483kB/s), io=543MiB (569MB), run=60004-60004msec

Disk stats (read/write):
  vda: ios=0/157737, merge=0/199976, ticks=0/1736140, in_queue=1736140, util=99.71%

单机预估值:2315

4、随机读吞吐

# fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randread -bs=1M -size=1G -time_based -runtime=60 -name=Fio -directory=/mnt
Fio: (g=0): rw=randread, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=128
fio-3.7
Starting 1 process
Fio: Laying out IO file (1 file / 1024MiB)
Jobs: 1 (f=1): [r(1)][100.0%][r=115MiB/s,w=0KiB/s][r=115,w=0 IOPS][eta 00m:00s]
Fio: (groupid=0, jobs=1): err= 0: pid=31872: Wed Mar  1 17:46:00 2023
   read: IOPS=114, BW=115MiB/s (121MB/s)(6911MiB/60129msec)
    slat (usec): min=84, max=133481, avg=8680.20, stdev=22149.47
    clat (msec): min=107, max=1498, avg=1097.39, stdev=92.10
     lat (msec): min=187, max=1500, avg=1106.07, stdev=91.79
    clat percentiles (msec):
     |  1.00th=[  709],  5.00th=[ 1011], 10.00th=[ 1011], 20.00th=[ 1083],
     | 30.00th=[ 1099], 40.00th=[ 1099], 50.00th=[ 1099], 60.00th=[ 1099],
     | 70.00th=[ 1099], 80.00th=[ 1150], 90.00th=[ 1183], 95.00th=[ 1200],
     | 99.00th=[ 1284], 99.50th=[ 1301], 99.90th=[ 1401], 99.95th=[ 1401],
     | 99.99th=[ 1502]
   bw (  KiB/s): min=10240, max=141312, per=99.18%, avg=116728.03, stdev=11685.07, samples=119
   iops        : min=   10, max=  138, avg=113.97, stdev=11.41, samples=119
  lat (msec)   : 250=0.17%, 500=0.45%, 750=0.39%, 1000=1.10%
  cpu          : usr=0.08%, sys=1.00%, ctx=13777, majf=0, minf=32800
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.2%, 32=0.5%, >=64=99.1%
     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.1%
     issued rwts: total=6911,0,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=128

Run status group 0 (all jobs):
   READ: bw=115MiB/s (121MB/s), 115MiB/s-115MiB/s (121MB/s-121MB/s), io=6911MiB (7247MB), run=60129-60129msec

Disk stats (read/write):
  vda: ios=110501/551, merge=0/258, ticks=15099450/49380, in_queue=15148830, util=99.15%

容量型单机预估值:115 MB/s

5、随机写吞吐

# fio -numjobs=1 -iodepth=128 -direct=1 -ioengine=libaio -sync=1 -rw=randwrite -bs=1M -size=1G -time_based -runtime=60 -name=Fio -directory=/mnt
Fio: (g=0): rw=randwrite, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=128
fio-3.7
Starting 1 process
Jobs: 1 (f=1): [w(1)][100.0%][r=0KiB/s,w=112MiB/s][r=0,w=112 IOPS][eta 00m:00s]
Fio: (groupid=0, jobs=1): err= 0: pid=970: Wed Mar  1 17:47:43 2023
  write: IOPS=114, BW=115MiB/s (120MB/s)(6903MiB/60078msec)
    slat (usec): min=71, max=216199, avg=8688.32, stdev=24002.51
    clat (msec): min=74, max=1510, avg=1097.12, stdev=153.09
     lat (msec): min=179, max=1510, avg=1105.80, stdev=154.05
    clat percentiles (msec):
     |  1.00th=[  693],  5.00th=[  869], 10.00th=[  902], 20.00th=[  986],
     | 30.00th=[ 1011], 40.00th=[ 1083], 50.00th=[ 1099], 60.00th=[ 1167],
     | 70.00th=[ 1200], 80.00th=[ 1217], 90.00th=[ 1284], 95.00th=[ 1301],
     | 99.00th=[ 1385], 99.50th=[ 1401], 99.90th=[ 1469], 99.95th=[ 1485],
     | 99.99th=[ 1519]
   bw (  KiB/s): min=83968, max=145408, per=99.93%, avg=117580.05, stdev=11343.85, samples=118
   iops        : min=   82, max=  142, avg=114.81, stdev=11.07, samples=118
  lat (msec)   : 100=0.01%, 250=0.14%, 500=0.43%, 750=0.61%, 1000=23.87%
  cpu          : usr=0.81%, sys=0.70%, ctx=7347, majf=0, minf=32
  IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.2%, 32=0.5%, >=64=99.1%
     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.1%
     issued rwts: total=0,6903,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=128

Run status group 0 (all jobs):
  WRITE: bw=115MiB/s (120MB/s), 115MiB/s-115MiB/s (120MB/s-120MB/s), io=6903MiB (7238MB), run=60078-60078msec

Disk stats (read/write):
  vda: ios=0/111532, merge=0/1037, ticks=0/12252406, in_queue=12252406, util=99.67%

容量型单机预估值:115 MB/s

0

评论区