All Products
Search
Document Center

Elastic Compute Service:Test block storage performance with fio

Last Updated:Apr 27, 2026

Use fio on a Linux ECS instance to measure raw disk IOPS, throughput, and latency for block storage performance tuning.

Note

fio is an open source I/O benchmarking tool that can test block storage performance metrics such as random and sequential read/write operations.

Procedure

Important
  • If a block storage device contains partitions, file systems, or data, fio may corrupt the file systems and cause data loss. Create snapshots before testing. See Create snapshot manually.

  • Do not test with the system disk or any data disk that contains data. Use a newly created, uninitialized, empty data disk instead.

  • Test results are obtained in a test environment and are for reference only. In production, cloud disk performance may vary due to factors such as network conditions and concurrent access.

  • After testing the new disk:

The following examples use an Alibaba Cloud Linux 3.2104 LTS 64-bit public image. Operations may vary depending on your instance image.

  1. Connect to an ECS instance.

    For more information, see Log on to a Linux instance using Workbench.

  2. Query block storage device names.

    sudo fdisk -lu

    截屏2024-12-05 09The instance has three block storage devices: system disk /dev/vda and two data disks /dev/vdb and /dev/vdc.

  3. Check for partitions and file systems on the devices.

    sudo blkid

    截屏2024-12-05 09Devices /dev/vda and /dev/vdb have partitions and file systems. Device /dev/vdc is not listed, indicating no partitions or file systems.

    Warning

    If the test object contains partitions, file systems, or data, fio may corrupt the file systems and cause data loss. If your data disk has partitions and file systems, create an empty data disk for testing.

  4. Back up the data on the devices before testing. See Create snapshot manually.

    Note

    Snapshots incur fees. See Snapshot billing.

  5. Install the libaio library and fio based on your operating system.

    Alibaba Cloud Linux 2/3, or CentOS 6 or later

    Note

    CentOS 6 reached end of life (EOL). In accordance with Linux community rules, all content was removed from the following CentOS 6 repository address: http://mirror.centos.org/centos-6/. If you continue to use the default CentOS 6 repository on Alibaba Cloud, an error is reported. To use specific installation packages of CentOS 6, change the CentOS 6 repository address. For more information, see How do I change CentOS 6 repository addresses?

    sudo yum install libaio libaio-devel fio -y

    Debian 9 or later, or Ubuntu 14 or later

    Important

    Debian 9 and Debian 10 reached their EOL. If your instance runs Debian 9 or Debian 10, change the repository addresses. See Change repository addresses after CentOS or Debian reached its EOL

    sudo apt-get update
    sudo apt-get install libaio* fio -y
  6. Change to the /tmp directory:

    cd /tmp
  7. Run the test commands.

  8. View the test results. Metric values vary by cloud disk category. The values in the following figures are for reference only.

  • The IOPS value indicates the IOPS test result. 截屏2024-11-19 11

  • The BW value indicates the throughput test result. 截屏2024-11-19 11

  • The lat (usec) value indicates the latency test result. 截屏2024-11-19 11

Cloud disk test commands

Warning

Running fio on a disk that contains partitions, a file system, or data can cause file system errors and data loss. If your data disk has partitions and a file system, create a new, empty data disk for testing:

  1. Create a pay-as-you-go disk with the same configuration and attach it to the instance. See Create a data disk.

  2. After the test is complete:

The parameter values in the following commands are for reference only. Replace /dev/your_device with your block storage device name obtained in Step 2 of the "Procedure" section. For example, replace /dev/your_device with /dev/vdb. For fio parameter details, see the fio parameters section.

  • Test random write IOPS.

    sudo 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
  • Test random read IOPS.

    sudo 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
  • Test sequential write throughput.

    sudo 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
  • Test sequential read throughput.

    sudo 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
  • Test random write latency.

    sudo 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
  • Test random read latency.

    sudo 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

See Test ESSD IOPS performance.

Local disk test commands

Warning

Running fio on a disk that contains partitions, file systems, or data will cause file system errors and data loss. If your data disk has partitions and a file system, create a new instance with local disks for testing:

  1. Local disks can only be created with an instance. Create a new instance with the same configuration for testing. See Custom launch ECS instances.

  2. After the test is complete:

The following commands apply to local NVMe SSDs and local SATA HDDs. The parameter values are for reference only. Replace /dev/your_device with your block storage device name obtained in Step 2 of the "Procedure" section. For example, replace /dev/your_device with /dev/vdb. For fio parameter details, see the fio parameters section.

  • Test random write IOPS.

    sudo 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
  • Test random read IOPS.

    sudo 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
  • Test sequential write throughput.

    sudo 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
  • Test sequential read throughput.

    sudo 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
  • Test random write latency.

    sudo 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
  • Test random read latency.

    sudo 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
  • Test sequential write latency.

    sudo 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
  • Test sequential read latency.

    sudo 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 parameters

The following table describes the fio parameters used in the preceding commands.

Parameter

Description

direct

Specifies whether to use direct I/O. Default value: 1. Valid values:

  • 1: uses direct I/O, bypasses the I/O buffer, and writes data directly.

  • 0: does not use direct I/O. Data goes through the I/O buffer.

iodepth

The I/O queue depth. For example, -iodepth 128 means up to 128 I/O operations can run in parallel per fio job.

rw

The read/write policy. Valid values:

  • randwrite: random writes

  • randread: random reads

  • read: sequential reads

  • write: sequential writes

  • randrw: random reads and writes

ioengine

The I/O engine. In most cases, libaio is used. For other engines, see the fio documentation.

bs

The block size of I/O units. Default value: 4k. Separate read/write values can be specified as <read>,<write>.

size

The test file size.

fio ends the test after the specified size is read or written, unless limited by runtime. If not specified, fio uses the full size of the given files or devices. Can also be a percentage (1-100). For example, size=20% uses 20% of the total file or device size.

numjobs

The number of concurrent threads. Default value: 1.

runtime

The test duration in seconds.

If not specified, the test runs until the files specified by size are fully read or written in the block size specified by bs.

group_reporting

The result display mode.

When specified, results are aggregated per process instead of per task.

filename

The test target path — a device name or file path. In this topic, the target is a raw disk without a file system. Replace /dev/your_device with the actual device path.

name

The test name. Specify as needed. In the preceding examples, Rand_Write_Testing is used.

See fio(1) - Linux man page for the full parameter reference.