This topic describes how to use the fio tool on a Linux Elastic Compute Service (ECS) instance to test the performance of Elastic Block Storage (EBS) devices. EBS devices include cloud disks and local disks, and the performance metrics of these disks include IOPS, throughput, and latency.
Prerequisites
Background information
You can use other tools to test the performance of EBS devices, but you may obtain different baseline performance. For example, tools such as dd, sysbench, and iometer may be affected by test parameters and file systems and return inaccurate results. The performance results in this topic are obtained from a fio test on a Linux instance. These results are used as performance references for Alibaba Cloud EBS devices. We recommend that you use the fio tool to test the performance of EBS devices for both Linux and Windows instances.
- You can obtain accurate test results by testing raw disk partitions. However, you may destroy the file system structure in a raw disk partition if you directly test the partition. Before you test a raw disk, we recommend that you create a snapshot of the disk to back up your data. For more information about how to create a snapshot, see Create a snapshot for a disk.
- We recommend that you do not test a disk where the operating system is located or a disk that stores important data. To prevent data loss, we recommend that you use a new Elastic Compute Service (ECS) instance that contains no data for the test.
Procedure
Commands used to test the performance of cloud disks
For information about how to test the IOPS of an enhanced SSD (ESSD), see Test the IOPS performance of an ESSD.
- Command used to test the random write IOPS of a cloud disk:
fio -direct=1 -iodepth=128 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Rand_Write_Testing
- Command used to test the random read IOPS of a cloud disk:
fio -direct=1 -iodepth=128 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Rand_Read_Testing
- Command used to test the sequential write throughput of a cloud disk:
fio -direct=1 -iodepth=64 -rw=write -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Write_PPS_Testing
- Command used to test the sequential read throughput of a cloud disk:
fio -direct=1 -iodepth=64 -rw=read -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Read_PPS_Testing
- Command used to test the random write latency of a cloud disk:
fio -direct=1 -iodepth=1 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=/dev/your_device -name=Rand_Write_Latency_Testing
- Command used to test the random read latency of a cloud disk:
fio -direct=1 -iodepth=1 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=/dev/your_device -name=Rand_Read_Latency_Testing
Commands used to test the performance of local disks
The following test commands are applicable to local Non-Volatile Memory Express (NVMe) SSDs and local Serial Advanced Technology Attachment (SATA) HDDs.
- Command used to test the random write IOPS of a local disk:
fio -direct=1 -iodepth=32 -rw=randwrite -ioengine=libaio -bs=4k -numjobs=4 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the random read IOPS of a local disk:
fio -direct=1 -iodepth=32 -rw=randread -ioengine=libaio -bs=4k -numjobs=4 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the sequential write throughput of a local disk:
fio -direct=1 -iodepth=128 -rw=write -ioengine=libaio -bs=128k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the sequential read throughput of a local disk:
fio -direct=1 -iodepth=128 -rw=read -ioengine=libaio -bs=128k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the random write latency of a local disk:
fio -direct=1 -iodepth=1 -rw=randwrite -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the random read latency of a local disk:
fio -direct=1 -iodepth=1 -rw=randread -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the sequential write latency of a local disk:
fio -direct=1 -iodepth=1 -rw=write -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
- Command used to test the sequential read latency of a local disk:
fio -direct=1 -iodepth=1 -rw=read -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=test
fio parameter settings
Parameter setting | Description |
---|---|
-direct=1 | Indicates that the I/O buffer is ignored during the test and data is directly written. |
-iodepth=128 | Indicates that when asynchronous I/O is used, up to 128 I/O requests can be concurrently made. |
-rw=randwrite | Indicates that the read/write policy is random writes. Other valid values for rw:
|
-ioengine=libaio | Indicates that libaio (the Linux-native asynchronous I/O facility) is used for the
test. An application can use I/O in the following ways:
|
-bs=4k | Indicates that the size of each block for one I/O is 4 KiB. The default value is also
4 KiB.
|
-size=1G | Indicates that the size of the test file is 1 GiB. |
-numjobs=1 | Indicates that the number of test threads is 1. |
-runtime=1000 | Indicates that the test duration is 1,000 seconds. If this parameter is not specified, the file of the size specified by -size is written in blocks of the size specified by -bs. |
-group_reporting | Indicates that in the test results, statistics are displayed for a group of threads, not for each individual thread. |
-filename=/dev/your_device | Indicate that the device name of the cloud disk is /dev/your_device. Replace the value with the actual name of your cloud disk. |
-name=Rand_Write_Testing | Indicates that the name of the test task is Rand_Write_Testing. You can specify a name. |