Rate This Document
Findability
Accuracy
Completeness
Readability

fio

Installing fio

You can install fio-3.7 using a Yum source. For example, run the following command to install fio-3.7 on CentOS 7.6.

1
yum -y install fio 

You can also use the following method to download, compile, and install the source package.

  1. Download the fio package to the /home directory of each client.
  2. Decompress the fio package on each client.
    1
    cd /home && tar -zxvf fio-3.7.tar.gz
    
  3. Go to the directory of the decompressed fio files.
    1
    cd fio-3.7
    
  4. Install the RBD engine dependency.
    1
    yum -y install librbd-devel
    

    To install librbd-devel, configure the Ceph source. For details, see Configuring the Deployment Environment in the Ceph Block Storage Deployment Guide (CentOS 7.6 & openEuler 20.03).

  5. Compile and install fio.
    1
    ./configure && make && make install
    

fio Test Model

fio runs by executing a workload configuration file. You only need to execute the workload configuration file on any of the clients. The client automatically logs in to other clients based on the IP addresses of other clients specified in the workload configuration file to perform the test. Before the test, mount the CephFS file system.

Creating a fio Workload

This document uses one Ceph client as an example. Each client reads and writes 3 files, and the maximum read and write capacity is 10 GB for each file. The following describes how to create a 1 MB sequential write workload on client1. Create three configuration files for each client.

  1. Create the first configuration file.
    1
    vi 1024Kclient1_file1_write.fio
    
    [global]  
    ioengine=libaio  
    size=10G  
    direct=1  
    numjobs=1  
    runtime=60  
    ramp_time=10  
    log_avg_msec=500  
    thread  
    time_based  
    [1024K-write]  
    filename=/mnt/cephfs/1024K_client1_file1  
    bs=1024K  
    rw=write  
    iodepth=64  
    write_bw_log=1024K-write  
    stonewall  
    buffer_compress_percentage=40
  2. Create the second configuration file.
    1
    vi 1024Kclient1_file2_write.fio
    
    [global]  
    ioengine=libaio  
    size=10G  
    direct=1  
    numjobs=1  
    runtime=60  
    ramp_time=10  
    log_avg_msec=500  
    thread  
    time_based  
    [1024K-read]  
    filename=/mnt/cephfs/1024K_client1_file2  
    bs=1024K  
    rw=read  
    iodepth=64  
    write_bw_log=1024K-read  
    stonewall  
    buffer_compress_percentage=40
  3. Create the third configuration file.
    1
    vi 1024Kclient1_file3_write.fio
    
    [global]  
    ioengine=libaio  
    size=10G  
    direct=1  
    numjobs=1  
    runtime=60  
    ramp_time=10  
    log_avg_msec=500  
    thread  
    time_based  
    [1024K-rw]  
    filename=/mnt/cephfs/1024K_client1_file3  
    bs=1024K  
    rw=rw  
    iodepth=64  
    write_bw_log=1024K-rw  
    rwmixwrite=30  
    stonewall  
    buffer_compress_percentage=40

    buffer_compress_percentage=40 is used for testing compression. If this parameter is configured, the data written by fio is compressed at a certain ratio. If a compression test is not required, you can delete the parameter.

Performing a Test Case

  1. Start the fio service.
    1
    fio -S &
    
  2. Execute the test case on client1 (image1write as an example).
    1
    fio --client=client1 ./1024Kclient1_image1write.fio --client=client1 ./1024Kclient1_image2write.fio --client=client1 ./1024Kclient1_image3write.fio   --output=./1mwrite.log
    

Viewing the Test Result

After the test is complete, the 1mwrite.log file in the current directory contains all test data.