In this lesson, you will learn how to conduct standardized I/O tests to objectively measure and compare the performance characteristics of different filesystem types.
Why Standardize Benchmarking?
When choosing a filesystem—such as comparing the Copy-on-Write capabilities of Btrfs against the metadata performance of XFS—it is easy to be misled by anecdotal speed. To get reliable data, we must use standardized testing patterns. Benchmarking is not just about raw speed; it is about observing how a filesystem handles specific I/O workloads, such as random reads (common in databases) versus sequential writes (common in large file transfers).
Running a Standardized Test with fio
The industry-standard tool for this task is fio (Flexible I/O Tester). Rather than just copying a file and checking the clock, fio allows us to isolate specific variables that define how a filesystem behaves under pressure.
To measure the performance of a directory on your mount point, you can run a standardized test like this:
fio --name=random-write --ioengine=libaio --rw=randwrite --bs=4k --size=1G --numjobs=1 --direct=1 --group_reporting
Here is what these flags represent in our standard:
--rw=randwrite: Targets random write performance to stress-test the filesystem's allocation algorithms.--bs=4k: Sets a fixed block size, ensuring you are testing the filesystem's ability to handle small, granular I/O requests.--direct=1: Bypasses the system's page cache, ensuring you are measuring the disk/filesystem latency rather than how much RAM is available to cache the data.
Interpreting the Results
When you run these tests, pay close attention to iops (input/output operations per second) and lat (latency). If you test two different filesystems using the exact same fio parameters on the same underlying hardware, the variance in these numbers will reveal the "overhead" each filesystem introduces.
For instance, a journaling filesystem might show higher latency during random writes because it must write the metadata to the journal before confirming the data write. By keeping your test parameters identical across different filesystems, you establish a baseline that helps you align your storage choice with your specific system workload.
Key Takeaway: Standardized benchmarking requires isolating variables like block size and cache behavior to ensure that the performance metrics reflect the filesystem’s efficiency rather than volatile system conditions.