• fio硬盘压力测试


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

    fio 官网地址:http://freshmeat.net/projects/fio/

    安装

    yum -y install libaio libaio-devel 
    wget http://brick.kernel.dk/snaps/fio-2.1.7.tar.bz2 
    
    tar xf fio-2.1.7.tar.bz2
    cd fio-2.1.7/ 
    ./configure  
    make -j10
    make install 

    二,测试案例介绍: 
    ##############################  同步i/o   ##################################################################3 
    #同步i/o、顺序读: 
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=read-psync >read-psync.txt 
    #同步i/o、顺序写: 
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=write-psync >write-psync.txt 
    #同步i/o、顺序混合读写: 
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=readwrite -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=rw-readwrite rw-readwrite-psync.txt
    #同步i/o、随机读:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randread-psync >randread-psync.txt 
    #同步i/o、随机写:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randwrite-psync >randwrite-psync.txt 
    #同步i/o、随机混合读写:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=psync -bs=16k -size=50G -numjobs=30 -runtime=100 -group_reporting -ioscheduler=noop -name=randrw-psync >randrw-psync.txt  
     
    ##############################  异步 i/o   ##################################################################3 
     #异步 i/o、顺序读:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=read -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=read-libaio >read-libaio.txt 
    #异步 i/o、顺序写: 
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=write -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=write-libaio >write-libaio.txt 
    #异步 i/o、顺序混合读写: 
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=readwrite -rwmixread=50 -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=rw-readwrite-libaio >rw-readwrite-psync.txt 
    #异步 i/o、随机读:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randread -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randread-libaio >randread-libaio.txt 
    #异步 i/o、随机写:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=1000 -group_reporting -name=randwrite-libaio >randwrite-libaio.txt 
    #异步 i/o、随机混合读写:  
    fio -filename=/dev/rbd2 -direct=1 -iodepth 1 -thread -rw=randrw -rwmixread=50 -ioengine=libaio -bs=16k -size=50G -numjobs=30 -runtime=100 -group_reporting -ioscheduler=noop -name=randrw-libaio >randrw-libaio.txt  
    说明:  
    filename=/dev/rbd2 测试文件名称,需要测试的盘的某目录。  
    direct=1 测试过程绕过机器自带的buffer。使测试结果更真实。  
    read 顺序读 
    write 顺序写 
    randwrite 随机写 
    randread 随机读 
    rw,readwrite 顺序混合读写 
    randrw 随机混合读写 
    bs=16k 单次io的块文件大小为16k  
    bsrange=512-2048 同上,提定数据块的大小范围  
    size=5g 本次的测试文件大小为5g,以每次4k的io进行测试。  
    numjobs=30 本次的测试线程为30.  
    runtime=1000 测试时间为1000秒,如果不写则一直将5g文件分4k每次写完为止。  
    ioengine=psync io引擎使用pync方式  
    rwmixread=30  在混合读写的模式下,读占30% ,默认%50,两个参数同时使用,后者覆盖第一 
    rwmixwrite=30 在混合读写的模式下,写占30% ,默认%50 
    group_reporting 关于显示结果的,汇总每个进程的信息。  
    lockmem=1g 只使用1g内存进行测试。  
    zero_buffers 用0初始化系统buffer。  
    nrfiles=8 每个进程生成文件的数量。  
    ioscheduler 尝试切换设备托管文件指定的I / O调度器。 
    psync  同步i/o测试 
    libaio  异步i/o测试 
    libaio的读写过程简单说来就是你发出一个读写请求,然后你可以开始做其他事情,当读写过程结束时libaio会通知你你的这次请求已经完成 
  • 相关阅读:
    redis接入sentinelPool的配置
    02.Redis主从集群的Sentinel配置
    淘宝大秒系统设计详解
    关于Thread.currentThread()和this的差异
    App开放接口api安全性—Token签名sign的设计与实现
    使用Spring Session做分布式会话管理
    PowerDesigner 15.1 安装步骤详细图解及破解
    解密ThreadLocal
    深入分析 ThreadLocal 内存泄漏问题
    一个经典例子让你彻彻底底理解java回调机制
  • 原文地址:https://www.cnblogs.com/cptao/p/10913078.html
Copyright © 2020-2023  润新知