zoukankan      html  css  js  c++  java
  • FIO使用指南

    前言

    fio是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括:sync,mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, solarisaio 等等。

    测试准备

    工具:fio - Flexible IO Tester

    官方网站:

    http://freecode.com/projects/fio

    http://brick.kernel.dk/snaps/

    注意: 性能测试建议直接通过写裸盘的方式进行测试,会得到较为真实的数据。但直接测试裸盘会破坏文件系统结构,导致数据丢失,请在测试前确认磁盘中数据已备份。

    CentOS可以直接使用yum安装

    #yum安装
    yum install libaio-devel fio
    #手动安装
    yum install libaio-devel
    wget http://brick.kernel.dk/snaps/fio-2.2.10.tar.gz
    tar -zxvf fio-2.2.10.tar.gz
    cd fio-2.2.10
    make $ make install
    For gfio, gtk 2.18 (or newer), associated glib threads, and cairo are required
    to be installed.  gfio isn't built automatically and can be enabled
    with a --enable-gfio option to configure.
     
    示例:
    对磁盘进行1024K顺序写
    fio cap_1024K_seq_write
    [global]
    ioengine=libaio
    bs=1024K
    rw=write
    ramp_time=6
    runtime=300
    direct=1
    iodepth=16
    #rwmixwrite=20
    time_based
    [test]
    filename=/dev/sda
    numjobs=1
    结果:
    test: (g=0): rw=write, bs=1M-1M/1M-1M/1M-1M, ioengine=libaio, iodepth=16
    fio-2.8
    Starting 1 process
    Jobs: 1 (f=1): [W(1)] [100.0% done] [0KB/68198KB/0KB /s] [0/66/0 iops] [eta 00m:00s]
    test: (groupid=0, jobs=1): err= 0: pid=4676: Thu Apr  7 17:22:37 2016
      write: io=20075MB, bw=68464KB/siops=66, runt=300255msec   #执行多少IO,平均带宽,线程运行时间
        slat (usec): min=51, max=5732, avg=291.11, stdev=262.47          #提交延迟
        clat (usec): min=1, max=2235.8K, avg=239043.28, stdev=153384.41   #完成延迟
         lat (usec): min=367, max=2235.9K, avg=239337.72, stdev=153389.57 #响应时间
        clat percentiles (usec):
         |  1.00th=[  221],  5.00th=[  442], 10.00th=[ 1004], 20.00th=[108032],
         | 30.00th=[228352], 40.00th=[248832], 50.00th=[257024], 60.00th=[268288],
         | 70.00th=[280576], 80.00th=[301056], 90.00th=[342016], 95.00th=[477184],
         | 99.00th=[806912], 99.50th=[864256], 99.90th=[1122304], 99.95th=[1171456],
         | 99.99th=[1646592]
        bw (KB  /s): min=  170, max=204800, per=100.00%, avg=68755.07, stdev=27034.84
        lat (usec) : 2=0.01%, 4=0.13%, 50=0.06%, 100=0.26%, 250=1.04%
        lat (usec) : 500=4.53%, 750=2.61%, 1000=1.33%
        lat (msec) : 2=1.18%, 4=0.15%, 10=0.77%, 20=0.77%, 50=1.50%
        lat (msec) : 100=4.43%, 250=23.48%, 500=53.23%, 750=3.09%, 1000=1.30%
        lat (msec) : 2000=0.19%, >=2000=0.01%
      cpu          : usr=0.03%, sys=2.11%, ctx=19066, majf=0, minf=7
      IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=103.8%, 32=0.0%, >=64=0.0%   #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%  
         issued    : total=r=0/w=20060/d=0, short=r=0/w=0/d=0, drop=r=0/w=0/d=0
         latency   : target=0, window=0, percentile=100.00%, depth=16    #IO完延迟的分布
     
    Run status group 0 (all jobs):
      WRITE: io=20075MB, aggrb=68464KB/s(group总带宽), minb=68464KB/s(最小平均带宽), maxb=68464KB/s(最大平均带宽), mint=300255msec(group中线程的最短运行时间), maxt=300255msec(group中线程的最长运行时间)
     
    Disk stats (read/write):
      sda: ios=23/41769(所有group总共执行的IO数), merge=0/149(总共发生的IO合并数), ticks=706/9102766(Number of ticks we kept the disk busy), in_queue=9105836(花费在队列上的总共时间), util=100.00%(磁盘利用率)
     
    FAQ:
    1.执行报:No package 'gtk+-2.0' found,No package 'gthread-2.0' found,configure: gtk and gthread not found
       A:yum install gtk2-devel
    2.执行fio -name test -runtime=30 -filename=/dev/sda3 -ioengine=libaio -direct=1 -bs=1024K -iodepth=16 -rw=write -time_based:
       报:fio: /dev/sda3 appears mounted, and 'allow_mounted_write' isn't set. Aborting.
       A:对sda压测
  • 相关阅读:
    Spring笔记②--各种属性注入
    Spring笔记①--helloworld
    Structs2笔记③--局部类型转换案例
    Struct2笔记②--完善登陆代码
    Structs2笔记①--structs的背景、structs2框架的意义、第一个helloworld
    软件项目的开发之svn的使用
    Java基础第一节.Java简介
    Hibernate笔记④--一级二级缓存、N+1问题、saveorupdate、实例代码
    Hibernate笔记③--集合映射、组合映射、联合主键、查询案例
    Hibernate笔记②--hibernate类生成表、id生成策略、级联设置、继承映射
  • 原文地址:https://www.cnblogs.com/dongdongwq/p/5390353.html
Copyright © 2011-2022 走看看