pg_test_fsync: Benchmarking Disk Write Performance for Databases
2025-05-28
This article introduces `pg_test_fsync`, a tool for quickly benchmarking disk or cloud storage write performance, particularly useful for database WAL logs and other low-latency write workloads. The author tests a consumer-grade Samsung 990 Pro SSD and an enterprise-grade Micron 7400 SSD, revealing significantly faster synchronous write speeds on the enterprise SSD due to its controller DRAM cache and power-loss protection. `fdatasync` proves faster than `fsync` or `O_SYNC`, but even `fdatasync` takes 1.6 milliseconds for a single 8kB write. The article notes that multiple small writes degrade performance, suggesting batching writes for efficiency.
Development