Disk I/O performance is one of the most critical factors in server and application performance. Slow storage causes everything from high database query latency to slow deployments. But measuring disk performance properly requires more than just running dd — you need sequential throughput, random IOPS, and latency measurements to get the full picture.
dargslan-disk-benchmark is a free Python CLI tool that runs a comprehensive disk I/O benchmark on any filesystem path. It measures sequential read/write speed, random read/write IOPS, and write latency with percentile breakdowns — all with zero dependencies.
Quick Start
pip install dargslan-disk-benchmark
dargslan-diskbench report # Full benchmark
dargslan-diskbench write -s 100 # Sequential write (100 MB)
dargslan-diskbench read -s 100 # Sequential read (100 MB)
dargslan-diskbench iops # Random IOPS test
dargslan-diskbench latency # Write latency (P50/P95/P99)
dargslan-diskbench report -p /mnt/ssd # Benchmark specific path
Understanding Disk Performance Metrics
Three key metrics define disk performance:
- Sequential throughput (MB/s): How fast the disk reads or writes large contiguous blocks. This matters for backups, log writes, and file transfers. Modern NVMe SSDs can exceed 3000 MB/s.
- Random IOPS: How many small random read/write operations per second the disk can handle. This is critical for databases, virtual machines, and web applications. Enterprise NVMe drives deliver 500K+ IOPS.
- Write latency: How long each individual write operation takes. The P99 latency (99th percentile) shows worst-case behavior. For databases, sub-millisecond P99 latency is ideal.
How the Benchmark Works
The tool uses Python's standard library file operations with os.fsync() to ensure data actually hits the disk (not just the OS cache). For sequential tests, it writes/reads configurable block sizes. For IOPS tests, it performs random-position writes and reads. For latency, it measures individual 512-byte write + fsync operations and calculates percentile distributions.
Python API
from dargslan_disk_benchmark import DiskBenchmark
db = DiskBenchmark(path="/data")
results = db.full_benchmark(size_mb=100)
for test in results['tests']:
if 'speed_human' in test:
print(f"{test['test']}: {test['speed_human']}")
elif 'iops' in test:
print(f"{test['test']}: {test['iops']} IOPS")
elif 'avg_ms' in test:
print(f"{test['test']}: avg={test['avg_ms']}ms P99={test['p99_ms']}ms")
Comparing Storage Types
Use this tool to compare different storage backends: local SSD vs NFS, EBS gp3 vs io2, or before/after filesystem tuning. The JSON output mode makes it easy to store results for historical comparison.
Best Practices
- Run benchmarks on the actual filesystem where your application data lives
- Test with sizes larger than your RAM to avoid cache effects
- Run multiple rounds and average the results for consistency
- Compare P99 latency, not just averages — tail latency kills user experience
- Benchmark before and after any storage changes to quantify improvements
Conclusion
Understanding your disk I/O performance is essential for capacity planning and troubleshooting. dargslan-disk-benchmark gives you professional-grade benchmarking with zero setup. Install it and start measuring your storage performance today.
For more Linux performance tools, visit dargslan.com and explore our eBooks and cheat sheets.