Fast Disks, Slow WAL Sync: Finding Linux Writeback Throttling
As described in the previous post , the primary now uses a high-I/O Ultra disk. Reads and writes took fractions of a millisecond, yet PostgreSQL WAL synchronization averaged 25-30 ms. Removing synchronous-standby waits didn't help: synchronous_commit=local still requires local WAL durability. With device-read constraints reduced and remote acknowledgments excluded, I traced the primary's…
The primary database server utilizes an ultra high-I/O disk, with PostgreSQL write-ahead log (WAL) synchronization taking an average of 25-30 milliseconds. Despite disabling synchronous standby waits, the WAL synchronization time remained the same. By tracing the synchronization call across the guest-OS boundary, it was discovered that Linux writeback throttling was causing the delay.
The relevant PostgreSQL counters show a mean WAL sync time of 24.995 milliseconds. The writeback throttling (WBT) can cause a process to sleep before the work reaches the device, affecting the overall synchronization time. Even with a healthy latency controller, the admission waits in WBT can lead to slow synchronization. The findings suggest that provisioning more disk IOPS does not change the guest-OS admission rule, but rather focuses on the caller's progress through writeback.
In this setup, HorizonDB delegates durable WAL handling and data page persistence to dedicated storage services, avoiding the Linux throttling issue and achieving higher throughput compared to this PostgreSQL configuration.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.