Introduction
fio (Flexible I/O Tester) is the industry-standard tool for benchmarking storage devices and filesystems. Written in C, it can simulate virtually any I/O workload pattern by combining configurable block sizes, queue depths, access patterns, and I/O engines. It is used by storage vendors, kernel developers, and DevOps engineers to validate hardware and tune systems.
What fio Does
- Generates sequential, random, or mixed read/write workloads at any block size
- Supports dozens of I/O engines including libaio, io_uring, sync, mmap, and RDMA
- Runs multiple parallel jobs to stress-test concurrency and queue depth scaling
- Reports IOPS, bandwidth, and latency at configurable percentile levels
- Accepts job files in INI format for repeatable, shareable benchmark definitions
Architecture Overview
fio spawns one or more worker threads or processes, each executing an I/O loop defined by a job specification. Each job selects an I/O engine (the syscall or library interface), an access pattern (sequential, random, zipf), and parameters like block size and queue depth. A central statistics collector aggregates per-job metrics and emits a summary with IOPS, bandwidth, and latency percentiles.
Self-Hosting & Configuration
- Install via package manager or compile from source with
./configure && make - Define workloads in
.fiojob files (INI-style) for reproducible benchmarks - Use
--direct=1to bypass the page cache and measure raw device performance - Select the I/O engine matching your target:
io_uringfor modern Linux,libaiofor legacy - Output results as JSON with
--output-format=jsonfor automated analysis pipelines
Key Features
- Supports 30+ I/O engines including io_uring, libaio, POSIX AIO, and Windows IOCP
- Configurable access patterns: sequential, random, strided, and custom distributions
- Per-job and group reporting with latency histograms and percentile breakdowns
- Verification mode writes checksums and reads them back to detect data corruption
- Job file format allows sharing and version-controlling benchmark definitions
Comparison with Similar Tools
- sysbench fileio — Simpler file I/O test but far fewer tuning options than fio
- dd — Basic sequential throughput test, no random I/O or latency reporting
- bonnie++ — Classic filesystem benchmark with fixed test patterns
- Iometer — Windows-centric GUI benchmark, less flexible than fio on Linux
- diskspd — Microsoft's storage benchmarking tool, Windows-focused
FAQ
Q: Should I use direct I/O or buffered I/O for benchmarks?
A: Use --direct=1 to measure raw device speed. Buffered I/O benchmarks test the page cache, which is useful for application-level analysis.
Q: What I/O engine should I use on modern Linux?
A: io_uring offers the best performance on Linux 5.1+. Fall back to libaio for older kernels.
Q: How do I benchmark NVMe devices?
A: Use io_uring or libaio with high iodepth (64-256) and multiple jobs to saturate the device's internal parallelism.
Q: Can fio simulate real application workloads?
A: Yes. Record an application's I/O trace with blktrace and replay it with fio's replay_redirect option.