简介
Fio是一个基于GPLV2授权的 开源 I/O 压力测试 工具,主要用来测试磁盘IO性能,也可用于测试CPU,NIC的IO性能。
配置流程
本文选用华为鲲鹏 云服务 ECS KC1实例做测试,KC1实例的处理器为兼容ARMv8指令集的鲲鹏920。
1.选择操作环境
本文选用华为鲲鹏云服务ECS KC1实例做测试
2.获取源代码
https://github.com/axboe/fio/releases提供Fio各版本的源码压缩包,可以直接下载。
3. 编译源代码
本文以“fio-2.1.10”版本为例,下载源码,并编译安装。
1)下载Fio源码。
wget https://github.com/axboe/fio/archive/fio-2.1.10.tar.gz
2)解压Fio源码。
tar -zxvf fio-2.1.10.tar.gz
3)编译并安装Fio。
cd fio-fio-2.1.10
make
make install
4)检查安装的Fio版本号。
fio --version
5)回显信息如下,则Fio安装成功。
fio-2.1.10
4.测试已完成编译的软件
以读带宽为例,测试Fio是否可以正常使用。
执行以下命令:
fio --filename=/tmp/test_read -direct=1 -rw=read -bs=1m -size=1G -numjobs=4 -runtime=10 -group_reporting -name=mytest
回显信息如下,若能正常显示磁盘读速率,则表示Fio可正常使用。
mytest: (g=0): rw=read, bs=1M-1M/1M-1M/1M-1M, ioengine=sync, iodepth=1
...
fio-2.1.10
Starting 4 processes
mytest: Laying out IO file(s) (1 file(s) / 1024MB)
Jobs: 4 (f=4): [RRRR] [100.0% done] [150.0MB/0KB/0KB /s] [150/0/0 iops] [eta 00m:00s]
mytest: (groupid=0, jobs=4): err= 0: pid=20659: Sat Jul 6 18:00:27 2019
read : io=1587.0MB, bw=153195KB/s, iops=149, runt= 10608msec
clat (msec): min=1, max=869, avg=26.72, stdev=133.87
lat (msec): min=1, max=869, avg=26.72, stdev=133.87
clat percentiles (msec):
| 1.00th=[ 3], 5.00th=[ 3], 10.00th=[ 3], 20.00th=[ 4],
| 30.00th=[ 4], 40.00th=[ 4], 50.00th=[ 5], 60.00th=[ 5],
| 70.00th=[ 5], 80.00th=[ 6], 90.00th=[ 7], 95.00th=[ 8],
| 99.00th=[ 848], 99.50th=[ 857], 99.90th=[ 865], 99.95th=[ 873],
| 99.99th=[ 873]
bw (KB /s): min=36283, max=40487, per=25.04%, avg=38354.52, stdev=879.60
lat (msec) : 2=0.57%, 4=47.20%, 10=48.20%, 20=1.13%, 50=0.13%
lat (msec) : 500=0.25%, 1000=2.52%
cpu : usr=0.05%, sys=0.15%, ctx=1599, majf=0, minf=84
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 : total=r=1587/w=0/d=0, short=r=0/w=0/d=0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: io=1587.0MB, aggrb=153194KB/s, minb=153194KB/s, maxb=153194KB/s, mint=10608msec, maxt=10608msec
Disk stats (read/write):
vda: ios=1602/4, merge=31/7, ticks=42550/0, in_queue=12010, util=34.53%