How does hardware queue depth correlate with log file sync wait?

How does hardware queue depth correlate with log file sync wait?

In a 1M TPS architecture, the Log File Sync (LFS) wait is often the ultimate "choke point." It represents the moment the CPU stops and waits for the physical world (the SSD/NVMe) to acknowledge that a transaction is safely on disk.

The relationship between Hardware Queue Depth (QD) and Log File Sync is a classic optimization trade-off: Throughput vs. Latency.


1. Defining the Mechanics

  • Log File Sync: The time between a user session issuing a COMMIT and receiving the "Success" signal. This includes the time to gather the log buffer, send it to the OS, and wait for the hardware to write it.

  • Hardware Queue Depth (QD): The number of I/O requests that the storage controller (NVMe/SATA) can hold in its "waiting room" simultaneously before it actually executes them on the NAND flash.


2. The Correlation: The "S" Curve of Latency

The correlation isn't linear; it follows a specific curve based on utilization.

Phase A: Low QD (Underutilization)

If your QD is 1 (synchronous writes), your Log File Sync wait is purely the hardware's raw latency.

  • Result: Low latency per sync, but your total TPS is capped by the speed of light (or electrons in the controller). At 1M TPS, a QD of 1 is impossible—you’d need a disk that responds in nanoseconds.

Phase B: Optimal QD (The Sweet Spot)

Modern NVMe drives thrive at high queue depths (often QD32 or QD64). By sending multiple log writes at once, the controller can parallelize the writing across multiple NAND channels.

  • Result: High throughput. You can batch 1,000 commits into a single I/O request. The Log File Sync wait stays stable because the hardware is efficiently "digesting" the work.

Phase C: High QD (The Saturation Point)

Once the hardware queue is full (e.g., QD > 128 on many consumer drives), the "Queueing Delay" begins.

  • The Math: Total Wait = Service Time + Queueing Time.

  • Result: Your Log File Sync wait skyrockets. Even if the disk is fast, your request is sitting in the "waiting room" (the hardware queue) before it even starts being written.


3. The "Group Commit" Paradox

At 1M TPS, you cannot do 1M individual disk writes. You use Group Commits.

  • How it works: The database waits a few microseconds to collect 500 transactions, then sends one large write to the hardware.

  • Impact on QD: This actually reduces the hardware queue depth (fewer, larger requests) but increases the Log File Sync wait for the first transaction in the batch.

  • The Trade-off: You are trading a small amount of "artificial" latency in the software to prevent a massive "queueing" latency in the hardware.


4. Modeling the Contention: Write Amplification

Hardware queue depth correlates with LFS wait through Write Amplification (WA). When the queue is consistently deep:

  1. The SSD controller gets "stressed."

  2. It triggers background Garbage Collection (GC) to clear blocks for the incoming flood.

  3. GC competes for the same hardware queue as your Log File Sync.

  4. The Result: A "Stochastic Spike." Your LFS wait jumps from 20$\mu$s to 10ms for a single frame, causing a backup in the CPU’s transaction logs.


5. Summary Table: Queue Depth vs. Wait Time

StrategyQueue DepthLog File Sync WaitUse Case
SynchronousLow (1-4)Lowest LatencyLow-volume, ultra-fast trading
AsynchronousHigh (32-128)High Throughput1M TPS Mainstream
SaturatedOverloaded (>256)Exponential SpikesSystem Failure / Bottleneck

The Verdict for 1M TPS

To model this, you must find the Saturation Point of your storage bus. If your NVMe maxes out at QD64, you should aim to keep your software-level batching tight enough that the hardware queue stays around QD16–32. This leaves "headroom" for the stochastic spikes we discussed earlier.

Looking for servers Rental ?

Call Our Expert :


  • (call for rental enquiries)

Email us :