×
Community Blog How to Use FIO to Test the IO Performance of ECS Local SSD and ESSD (Part 1)

How to Use FIO to Test the IO Performance of ECS Local SSD and ESSD (Part 1)

In this article, the author explains testing the IO performance of Local SSD and ESSD storage types of ECS in Alibaba Cloud using FIO.

By digoal

Background

Hard disks tested with different tools may produce different performance results. For example, test parameters and file systems may affect testing tools such as dd, sysbench, and iometer, thus causing inaccurate results. The performance parameters in this article are the result of FIO tests on Linux, which also serve as the references for the performance of Alibaba Cloud block storage products. We recommend FIO for testing the block storage performance on Linux and Windows instances.

1) Before the test, ensure that the file system is aligned in 4K.

parted -a optimal -s /dev/vdj mklabel gpt mkpart primary 1MiB 100%FREE    
  
mkfs.ext4 /dev/vdj1 -m 0 -O extent,uninit_bg -E lazy_itable_init=1 -b 4096 -T largefile -L vdj1  
  
vi /etc/fstab       
LABEL=vdj1 /data02 ext4 defaults,noatime,nodiratime,nodelalloc,barrier=0,data=writeback 0 0    
  
mkdir /data02    
  
mount -a    

2) Run the following commands in sequence to install libaio and FIO.

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm  
  
sudo yum install libaio –y  
sudo yum install libaio-devel –y  
sudo yum install fio -y  

Performance Test Commands — Common Cloud Disks

We recommend the page size of the database or the WAL size for the test.

1) Random write IOPS (4 KB for single I/O):

fio -direct=1 -iodepth=128 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=iotest -name=Rand_Write_Testing  

2) Random read IOPS (4KB for single I/O):

fio -direct=1 -iodepth=128 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=iotest -name=Rand_Read_Testing  

3) Sequential write throughput (write bandwidth) (1024 KB for single I/O):

fio -direct=1 -iodepth=64 -rw=write -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=iotest -name=Write_PPS_Testing  

4) Sequential read throughput (read bandwidth) (1024 KB for single I/O):

fio -direct=1 -iodepth=64 -rw=read -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=iotest -name=Read_PPS_Testing  

5) Random write latency (4 KB for single I/O):

fio -direct=1 -iodepth=1 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=iotest -name=Rand_Write_Latency_Testing  

6) Random read latency (4KB for single I/O):

fio -direct=1 -iodepth=1 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=iotest -name=Rand_Read_Latency_Testingrandwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=iotest -name=Rand_Write_Latency_Testing  

Performance Test Commands — Local Disks

The following test commands are applicable only to local NVMe SSD disks. Write to the disk directly. If there are file systems and contents on your disk, don’t test them directly. Instead, change /dev/vdx of the filename to the absolute path of the filename.

1) Random write IOPS (4 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=32 -rw=randwrite -ioengine=libaio -bs=4k -numjobs=4 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test  

2) Random read IOPS (4 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=32 -rw=randread -ioengine=libaio -bs=4k -numjobs=4 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test  

3) Sequential write throughput (write bandwidth) (128 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=128 -rw=write -ioengine=libaio -bs=128k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test   

4) Sequential read throughput (read bandwidth) (128 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=128 -rw=read -ioengine=libaio -bs=128k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test   

5) Random write latency (4 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=1 -rw=randwrite -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test  

6) Random read latency (4 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=1 -rw=randread -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test  

7) Sequential write latency (4 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=1 -rw=write -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test  

8) Sequential read latency (4 KB for single I/O):

# 如果您的磁盘里面有文件系统和内容,千万不要直接测试,可以把filename的/dev/vdx改成文件名绝对路径。 
fio -direct=1 -iodepth=1 -rw=read -ioengine=libaio -bs=4k -numjobs=1 -time_based=1 -runtime=1000 -group_reporting -filename=/dev/vdx -name=test   

FIO Parameter Description

Take the random write IOPS (randwrite) of the cloud disk test as an example. The following table describes the FIO parameters.

Parameter Description
-direct=1 The I/O buffer is ignored during the test and data is written directly.
-iodepth=128 When asynchronous I/O (AIO) is used, up to 128 I/O requests can be made concurrently.
-rw=randwrite Random writes are selected as the read/write policy during tests. In other tests, the policy can be set as: randread (random reads), read (sequential reads), write (sequential writes), or randrw (mixed random reads and writes)
-ioengine=libaio libaio (Linux AIO, asynchronous I/O) is selected for the test. I/O is usually used in applications in two ways. Synchronously: Synchronous I/O sends only one I/O request at a time and the request is not returned until the kernel completes it. In this case, the iodepth is always less than 1 for a single thread. Concurrent execution of multiple threads can serve as a solution here. Usually, 16 to 32 threads run in parallel to fill the iodepth. Asynchronously: Asynchronous I/O sends a batch of I/O requests at a time through libaio and waits until all of them are completed. This reduces the number of interactions and increases interaction efficiency.
-bs=4k The size of the block file for a single I/O is 4 KB, which is also the default size. We recommend setting bs to a small value such as 4k when testing IOPS. We also recommend setting bs to a large value such as 1024k when testing throughput.
-size=1G The size of the test file is 1 GB.
-numjobs=1 The number of test threads is 1.
-runtime=1000 The test duration is 1,000 seconds. If not specified, the size of the file is specified by the above. -size is written in blocks of the size specified by -bs.
-group_reporting Statistics for each thread are displayed in the test results, not in different jobs.
-filename=iotest The name of the test file is iotest.
-name=Rand_Write_Testing The name of the test task is Rand_Write_Testing. You can specify the name as needed.

References

0 0 0
Share on

digoal

282 posts | 24 followers

You may also like

Comments