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, you need to create several RBD images. fio performs read and write tests on these images.

Creating a fio Workload

In this example, one Ceph client is used. Each client is mapped to three RBDs. The maximum read/write size of each RBD is 20 GB. The following describes how to create a 1 MB sequential write workload on client1. Create three image configuration files for each client.

  1. Create the first image configuration file.
    1
    vi 1024Kclient1_image1write.fio
    
    [global]  
    ioengine=rbd  
    clientname=admin  
    pool=vdbench  
    size=100G  
    direct=1  
    numjobs=1  
    runtime=300  
    ramp_time=10  
    log_avg_msec=500  
    thread  
    time_based  
    rbdname=image1  
    [1024K-write]  
    bs=1024K  
    rw=write  
    iodepth=64  
    write_bw_log=1024K-write  
    stonewall  
    buffer_compress_percentage=40
  2. Create the second image configuration file.
    1
    vi 1024Kclient1_image2write.fio
    
    [global]  
    ioengine=rbd  
    clientname=admin  
    pool=vdbench  
    size=100G  
    direct=1  
    numjobs=1  
    runtime=300  
    ramp_time=10  
    log_avg_msec=500  
    thread  
    time_based  
    rbdname=image2  
    [1024K-write]  
    bs=1024K  
    rw=write  
    iodepth=64  
    write_bw_log=1024K-write  
    stonewall  
    buffer_compress_percentage=40
  3. Create the third image configuration file.
    1
    vi 1024Kclient1_image3write.fio
    
    [global]  
    ioengine=rbd  
    clientname=admin  
    pool=vdbench  
    size=100G  
    direct=1  
    numjobs=1  
    runtime=300  
    ramp_time=10  
    log_avg_msec=500  
    thread  
    time_based  
    rbdname=image3  
    [1024K-write]  
    bs=1024K  
    rw=write  
    iodepth=64  
    write_bw_log=1024K-write  
    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.