IOPS (Input/Output Operations Per Second) is a crucial metric for storage performance evaluation. In Linux environments, we have multiple tools available for measuring IOPS capabilities. The actual performance depends on various factors including storage type (HDD/SSD/NVMe), filesystem, kernel I/O scheduler, and workload characteristics.
Here are the most reliable tools for IOPS benchmarking:
# Install necessary tools on Debian/Ubuntu
sudo apt-get install fio ioping hdparm -y
# For RHEL/CentOS
sudo yum install fio ioping hdparm -y
FIO (Flexible I/O Tester) is the gold standard for storage benchmarking:
# Random read test (4KB blocks, 16 jobs, 60 seconds)
fio --name=random-read --ioengine=libaio --iodepth=16 --rw=randread \
--bs=4k --direct=1 --size=1G --numjobs=16 --runtime=60 --group_reporting
# Sequential write test
fio --name=seq-write --ioengine=libaio --iodepth=32 --rw=write \
--bs=128k --direct=1 --size=4G --runtime=60 --group_reporting
For latency-focused measurements:
# Measure latency and estimated IOPS
ioping -c 100 /dev/sdX
# Disk seek rate measurement
ioping -R /dev/sdX
Key metrics to analyze:
- IOPS: The primary metric showing operations per second
- Latency: Average, minimum, and maximum response times
- Throughput: MB/s when dealing with large block sizes
- Queue depth: How performance scales with parallel requests
For accurate measurements:
# Ensure cache is bypassed
echo 3 > /proc/sys/vm/drop_caches
# Check current scheduler
cat /sys/block/sdX/queue/scheduler
# Set appropriate scheduler (for SSDs)
echo none > /sys/block/sdX/queue/scheduler
Create a cron job for periodic testing:
#!/bin/bash
DATE=$(date +%Y%m%d)
LOG="/var/log/iops-benchmark/$DATE.log"
echo "=== IOPS Benchmark $DATE ===" > $LOG
fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread \
--bs=4k --direct=1 --size=1G --runtime=60 --group_reporting >> $LOG
IOPS (Input/Output Operations Per Second) is a critical performance metric for storage systems. In Linux environments, measuring IOPS helps administrators evaluate disk performance, identify bottlenecks, and optimize storage configurations.
Several command-line tools are available for IOPS measurement:
# Install fio (Flexible I/O Tester)
sudo apt-get install fio # Debian/Ubuntu
sudo yum install fio # RHEL/CentOS
# Basic fio command to measure random read IOPS
fio --name=random-read --ioengine=libaio --iodepth=32 \
--rw=randread --bs=4k --direct=1 --size=1G --numjobs=4 \
--runtime=60 --time_based --group_reporting
The fio output provides detailed performance metrics:
read: IOPS=12.3k, BW=48.2MiB/s (50.6MB/s)
Key metrics to analyze:
- IOPS: The actual operations per second
- BW: Bandwidth achieved
- Latency: 99th percentile values are particularly important
For quick checks, these commands can provide basic IOPS estimates:
# Using dd for sequential write test
dd if=/dev/zero of=./testfile bs=1M count=1024 conv=fdatasync
# Using ioping for latency measurement
ioping -c 20 .
Consider these variables when benchmarking:
- Block size (4k is standard for IOPS measurements)
- Queue depth (higher values simulate heavier workloads)
- Read/write mix (100% reads, 100% writes, or mixed)
- Filesystem vs raw device testing
- Caching effects (use O_DIRECT to bypass page cache)
For regular monitoring, consider this bash script:
#!/bin/bash
TEST_FILE="/mnt/testfile"
SIZE="1G"
BLOCK_SIZE="4k"
ENGINE="libaio"
DEPTH=32
RUNTIME=60
echo "Running read test..."
fio --name=read-test --filename=$TEST_FILE --ioengine=$ENGINE \
--iodepth=$DEPTH --rw=randread --bs=$BLOCK_SIZE --direct=1 \
--size=$SIZE --runtime=$RUNTIME --time_based --group_reporting
echo "Running write test..."
fio --name=write-test --filename=$TEST_FILE --ioengine=$ENGINE \
--iodepth=$DEPTH --rw=randwrite --bs=$BLOCK_SIZE --direct=1 \
--size=$SIZE --runtime=$RUNTIME --time_based --group_reporting
For comprehensive analysis:
# Measure IOPS at different queue depths
for i in {1,2,4,8,16,32,64}; do
fio --name=qd$i --ioengine=libaio --iodepth=$i \
--rw=randrw --rwmixread=70 --bs=4k --direct=1 \
--size=1G --runtime=60 --time_based --group_reporting
done