How to Use fio to Measure Disk IOPS, Throughput, and Latency on Ubuntu
This guide explains how to install fio on Ubuntu 20.04, configure test environments, run IOPS and latency benchmarks with specific parameters, and interpret key metrics such as bandwidth, IOPS, slat, and clat to evaluate storage performance under high‑load and single‑request scenarios.
Introduction
fio is a flexible I/O workload generator for measuring storage performance (IOPS, bandwidth, latency). It can issue sequential or random reads/writes, run multiple threads, and simulate heavy load.
Test environment
Ubuntu 20.04.5 LTS, kernel 5.4.0-125-generic. Install fio:
# sudo apt update
# sudo apt install fio
# fio --version
fio-3.16IOPS / bandwidth benchmark
Run a mixed random read/write test on block device /dev/vdd with four jobs, 1 MiB block size, queue depth 32, and 100 GiB per job for 120 seconds.
fio \
--name=iops-test \
--filename=/dev/vdd \
--rw=randrw \
--bs=1M \
--numjobs=4 \
--iodepth=32 \
--size=100G \
--runtime=120 \
--direct=1 \
--ioengine=libaio \
--group_reportingKey parameters: --filename : target block device --rw=randrw : mixed random read/write --bs=1M : I/O size --numjobs=4 : concurrent jobs (threads) --iodepth=32 : queue depth --size=100G : data per job --runtime=120 : test duration (seconds) --direct=1 : bypass page cache --ioengine=libaio : Linux asynchronous I/O --group_reporting : aggregate output
Important output columns:
BW : bandwidth (MiB/s or MB/s)
IOPS : operations per second
slat : submission latency (time from request submission to kernel entry)
clat : completion latency (time kernel spends processing the request)
Latency‑focused benchmark
To measure raw latency, use a small block size, a single job, and queue depth 1, which disables queue‑level optimizations.
fio \
--name=latency-test \
--filename=/dev/vdd \
--rw=randread \
--bs=4k \
--numjobs=1 \
--iodepth=1 \
--size=10G \
--runtime=60 \
--direct=1 \
--ioengine=libaio \
--group_reportingFocus on slat and clat values to assess the base response time of the device.
Interpreting results
For the IOPS test, examine the BW and IOPS columns to evaluate throughput and operation rate. For the latency test, review slat and clat percentiles to understand typical and worst‑case response times. Adjust --bs, --iodepth, and --numjobs to target different performance aspects (bandwidth vs. latency).
Tech Stroll Journey
The philosophy behind "Stroll": continuous learning, curiosity‑driven, and practice‑focused.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
