Sequential vs Random I/O
Disk I/O operations fall into two primary categories: sequential and random access patterns. Sequential operations read or write data in contiguous blocks, minimizing seek time and maximizing throughput—this is the metric that matters most for traditional hard disk drives. Random operations access non-contiguous locations across the storage medium, causing frequent head movements and seek operations, which becomes the critical performance indicator for solid-state drives.
Understanding thece patterns helps determine which benchmark approach suits your storage subsystem.
FIO Overview
FIO (Flexible I/O Tester) is a sophisticated benchmarking utility designed for stress testing, performance validation, and hardware verification. It supports 19 different I/O engines including sync, mmap, libaio, posixaio, SG v3, splice, null, network, syslet, guasi, and solarisaio. The tool operates on both block devices and regular files, accepts job definitions in human-readable text format, and reports comprehensive latency statistics including percentile distributions.
FIO runs on Linux, FreeBSD, NetBSD, OpenBSD, macOS, OpenSolaris, AIX, HP-UX, Android, and Windows.
Installation
Install FIO using your distribution's package manager:
yum install fio -y
Verify the installation:
fio --version
Essential Parameters
| Parameter | Description |
|---|---|
| directory | Mount point containing test files, separated by colons for multiple paths |
| filename | Target device or file path, colon-separated for multiple targets |
| direct | Bypasses system cache (1=enabled, 0=disabled) for accurate results |
| rw | Workload type: read, write, randread, randwrite, randrw |
| rwmixread | For mixed workloads, specifies read percentage (e.g., 70 means 70% reads) |
| bs | Block size per I/O operation (default 4KB) |
| bsrange | Range of block sizes (e.g., 8k-1M) |
| size | Total data volume per thread |
| runtime | Time-limited test duration in seconds |
| ramp_time | Warm-up period before measurements begin |
| ioengine | I/O engine selection (sync, libaio, psync, etc.) |
| iodepth | Number of concurrent outstanding I/Os |
| numjobs | Number of parallel worker processes |
| thread | Use threads instead of fork for process creation |
| group_reporting | Aggregate results from all workers |
| name | Job identifier for the test |
| output | Write results to specified file |
| lockmem | Limit memory usage during test |
| stonewall | Wait for previous job to complete before starting |
Benchmark Commands
Sequential Write Test
fio -filename=/dev/vdb -ioengine=sync -direct=1 -thread -iodepth=1 \
-group_reporting -rw=write -bs=4k -size=2G -runtime=120 \
-name=seq_write_benchmark
This performs 100% sequential writes to /dev/vdb using synchronous I/O with cache disabled. Each worker processes 2GB of data over a 120-second window.
Random Read Test
fio -filename=/dev/vdb -ioengine=libaio -direct=1 -iodepth=32 \
-group_reporting -rw=randread -bs=4k -size=4G -runtime=60 \
-name=rand_read_benchmark
Uses libaio engine with queue depth 32 to simulate high-concurrency random read operations, suitable for evaluating SSD performance under heavy load.
Mixed Workload Test
fio -filename=/dev/vdb -ioengine=sync -direct=1 -iodepth=1 \
-group_reporting -rw=rw -rwmixread=70 -bs=16k -size=1G \
-runtime=90 -ramp_time=5 -name=mixed_io_benchmark
Combines 70% reads with 30% writes in sequential pattern. The ramp_time parameter ensures stable measurements by discarding the first 5 seconds of data.
Random Read-Write Mix
fio -filename=/dev/vdb -ioengine=psync -direct=1 -numjobs=4 \
-group_reporting -rw=randrw -rwmixwrite=30 -bs=8k -size=512M \
-runtime=60 -name=rand_mixed_benchmark
Spawns 4 parallel processes, each handling 512MB with 30% writes and 70% reads in random patterns.
Monitoring During Tests
Track disk utilization in real-time with the sysstat package:
yum install sysstat -y
iostat -x 1
The iostat command with the -x flag displays extended statistics, and the interval parameter causes updates every second.
Key Metrics Interpretation
The fio output provides several critical values:
- IOPS: Input/output operations per second—higher values indicate better performance for the tested workload
- Bandwidth: Data transfer rate typically measured in MB/s or GB/s
- Latency: Operation response times including average, minimum, maximum, and percentile distributions (lat%, clat%)
- CPU utilization: Overhead consumed during benchmarking
For sequential workloads, prioritize bandwidth metrics. For random access patterns, focus on IOPS and latency percentiles.
Precautions
Always use dedicated test partitions or drives separate from the operating system. Sustained write operations to system disks risk data corruption and system instability. In virtualized environments, attaching new virtual disks provides safe isolation for testing purposes.