What it is¶
fio generates configurable I/O workloads and reports IOPS, throughput, and latency percentiles. It is the standard storage benchmark.
sudo dnf -y install fio # or apt-get install fio
Example jobs¶
Always test against a file on the filesystem you care about, with --direct=1 to bypass the page cache, so you measure the disk and not RAM.
# 4k random read: typical database-style workload
fio --name=randread --filename=/data/fio.test --size=2G --rw=randread --bs=4k \
--ioengine=libaio --iodepth=32 --direct=1 --runtime=60 --time_based --group_reporting
# 4k random write
fio --name=randwrite --filename=/data/fio.test --size=2G --rw=randwrite --bs=4k \
--ioengine=libaio --iodepth=32 --direct=1 --runtime=60 --time_based --group_reporting
# Sequential write throughput with large blocks
fio --name=seqwrite --filename=/data/fio.test --size=4G --rw=write --bs=1M \
--ioengine=libaio --iodepth=8 --direct=1 --runtime=60 --time_based --group_reporting
# Mixed 70/30 read/write, 4 workers
fio --name=mixed --filename=/data/fio.test --size=2G --rw=randrw --rwmixread=70 --bs=4k \
--ioengine=libaio --iodepth=16 --numjobs=4 --direct=1 --runtime=60 --time_based --group_reporting
Remove the test file afterwards (rm /data/fio.test).
Do not point --filename at a raw block device (/dev/sdX) that holds data with write tests. fio will overwrite it.
Reading results¶
Look at IOPS, BW (bandwidth), and the completion latency (clat) percentiles. The 99th and 99.9th percentile figures show tail latency, which matters more to applications than averages. Watch the system while it runs with iostat (iostat -xz 1).