Linux Disk IO Performance Test
Updated at:2025-10-20
This document provides an introduction to IO performance testing tools in BCC Linux systems. Using CentOS 7.6 as an example, the key aspects are outlined below (test results should be used for reference and interpreted in conjunction with the server's specific workload and configuration).
- Performance Metrics
Generally, the following metrics are used to measure cloud disk server performance:
- IOPS refers to input/output operations per second, measured in counts. The type of underlying storage driver determines the possible IOPS values.
- Throughput measures the amount of data read or written per second, expressed in MB/s.
- Latency is the time taken between initiating an I/O operation and receiving a response, measured in seconds.
- Test tools
FIO is a disk performance testing tool used for hardware stress testing and verification. This document uses FIO as an example.
Warning:
- Avoid performing FIO tests on the system disk to prevent potential damage to critical system files.
- To prevent data corruption from underlying system metadata damage, refrain from performing tests on the data disk.
- Verify that the File ConfigMap in /etc/fstab does not include mount configurations for the disk being tested; otherwise, the cloud server may fail to start.
- Tool Installation
This guide uses a CentOS 7.6 cloud server as an example. You can quickly install the testing tools fio and libaio via yum.
Shell
1$ yum install libaio -y
2$ yum install libaio-devel -y
3$ yum install fio -y
- Test example
- Parameter description:
| Parameter name | Description | Sample values |
|---|---|---|
| bs | Block size per request. Options include 4k, 8k, 16k, and more. | 4k |
| ioengine | I/O engine. Using Linux's asynchronous I/O engine is recommended. | libaio |
| iodepth | Depth of the requested I/O queue. | 1 |
| direct | Specify direct mode. • True (1) indicates specifying the O_DIRECT identifier, ignoring the I/O cache, and writing data directly. • False (0) indicates that the O_DIRECT identifier is not specified. Default to True (1). |
1 |
| rw | Read/write mode. Options include sequential read (read), sequential write (write), random read (randread), random write (randwrite), mixed random read/write (randrw), and mixed sequential read/write (rw, readwrite). | read |
| time_based | Specify time mode. This parameter can be left unset if FIO operates based on time. | N/A |
| runtime | Define the test duration, i.e., the runtime of FIO, in seconds. | 600 |
| refill_buffers | FIO refills the I/O buffer with every submission. By default, data is only populated and reused once at the start. | N/A |
| norandommap | During random I/O, FIO overwrites each block of the file. If this parameter is set, a new offset is chosen without referencing past I/O history. | N/A |
| randrepeat | Indicates whether random sequences are repeatable: True (1) means the sequence is repeatable, and False (0) means it isn't. The default setting is True (1). | 0 |
| group_reporting | When multiple jobs are executed concurrently, display the statistical values for the entire group. | N/A |
| name | Name assigned to the job. | fio-read |
| size | The address space utilized for I/O testing. | 100GB |
| filename | The targeted test object, specifically the name of the disk device being tested. | /dev/sdb |
- Test scenario
- bs = 4k iodepth = 1: Random read/write test, reflecting the latency performance of the hard disk (filename needs to specify the specific disk letter in the device, taking/dev/vda1 as an example below)
Execute the following command to test the random read latency of the hard disk.
Shell
1$ fio -bs=4k -ioengine=libaio -iodepth=1 -direct=1 -rw=randread -time_based -runtime=600 -randrepeat=0 -name=fio-randread-lat --size=10G -filename=/dev/vda1
- Run the following command to test the random write latency of the hard disk.
Shell
1$ fio -bs=4k -ioengine=libaio -iodepth=1 -direct=1 -rw=randwrite -time_based -runtime=600 -randrepeat=0 -name=fio-randwrite-lat --size=10G -filename=/dev/vda1
- Run the following command to test the random mixed read/write latency performance.
Shell
1$ fio -bs=4k -ioengine=libaio -iodepth=1 -direct=1 -rw=randrw -time_based --runtime=600 -randrepeat=0 -name=fio-read --size=1G --filename=/dev/vda1
