Repository navigation
Preserve TLog write bandwidth when disk space caps the queue target - #14672
tclinkenbeard-oai wants to merge 2 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Shrinking the spring before disk space caps the queue target can raise the write limit as the disk fills. Limit the reduction in the spring to the reduction in the target. Check the remaining write budget at and below the batch target as well as under severe disk pressure.
tclinkenbeard-oai
left a comment
There was a problem hiding this comment.
Generated by Codex.
What problem is this PR trying to solve? (ELI10)
Ratekeeper decides how fast transactions can start by checking how much work a transaction log can hold. It sets a queue target and subtracts a cushion called the spring. Imagine a log with 375 MB free above its safety reserve. The old calculation could set both the target and the cushion to 375 MB. That left zero bytes for writes, so a log that had recently received traffic could pause new transactions even with an empty queue. Old disk caps · Old bandwidth calculation
How does this PR solve the problem? (ELI10 and review walkthrough)
With the normal settings, the 375 MB example now gets a 75 MB cushion, leaving 300 MB for writes. The cushion shrinks only as far as the configured write allowance permits.
- Ratekeeper subtracts the reserve from the log’s smoothed free space, scales both settings as the disk fills, and caps the queue target at the space above the reserve. Disk measurement and target
- The helper starts with the smaller of the scaled spring and one fifth of the capped target. It keeps at least one byte for the spring and raises it if necessary to keep the write budget within the scaled allowance. Spring calculation
- The resulting difference sets the point where the queue starts exerting pressure and the bytes allowed over the read transaction lifetime plus two seconds. The separate emergency stop uses the latest disk sample. Proxies enforce the resulting normal and batch rates. Queue pressure and emergency stop · Bandwidth limit · Rates sent to proxies · Proxy admission
What is it trying to do?
Keep transactions moving when disk space limits the log queue, while respecting the write ceiling for each priority.
Is it correct?
Yes. With the batch defaults, the 1,400 MB target and 300 MB spring allow 1,100 MB of writes per window. As usable space falls from 1,500 MB to 1,400 MB, the target still fits and the spring stays at 300 MB. At 1,390 MB the spring falls to 290 MB, keeping the budget at 1,100 MB. For fixed scaled settings, reducing the target can only maintain or lower that budget. At exhaustion the target and spring both reach one byte, giving zero bandwidth. Batch defaults · Budget bound and regression checks
Are there bugs?
I found no correctness bugs in the published revision. The one-byte floor also keeps the queue-pressure divisor positive.
Are there omissions?
The compile-time checks cover the original stall, the batch boundary, and exhaustion. The main residual uncertainty is how quickly queue feedback responds to a burst while the free-space estimate catches up. I reviewed the source without running builds or tests during this review. Public CI was in progress for this head. PR checks
Are there better ways of doing things?
Keeping the bound in the spring calculation gives the queue and bandwidth calculations the same threshold with constant work per log.
Should this CL be LGTMd?
Yes, LGTM.
Result of foundationdb-pr-clang-arm on Linux RHEL 9
|
Result of foundationdb-pr-clang-ide on Linux RHEL 9
|
Result of foundationdb-pr-clang on Linux RHEL 9
|
Result of foundationdb-pr on Linux RHEL 9
|
Result of foundationdb-pr-macos on macOS
macOS stat flags, not linux compatiblelock_mtime() { stat -f %m $LOCK || echo 0 }
|
Result of foundationdb-pr-macos-m1 on macOS
macOS stat flags, not linux compatiblelock_mtime() { stat -f %m $LOCK || echo 0 }
|
Result of foundationdb-pr-cluster-tests on Linux RHEL 9
|
Ratekeeper subtracts the TLog queue spring from the target to compute the MVCC write bandwidth. When both are capped at the same positive disk headroom, the result is zero even with an empty queue.
Cap the scaled spring at one fifth of the headroom, keeping the one-byte floor. This moves the onset of queue throttling closer to the target under disk pressure. The target ramp, free-space reserve and emergency stop are unchanged.
Compile-time checks cover a constrained spring, an unconstrained spring and exhausted headroom. All 20 simulation cases passed across MinimumThroughput, DiskFailureCycle and LocalRatekeeper. In two additional MinimumThroughput cases with a 12 GB target, an 8 GB spring and throttle start ratios of 5% and 20%, main failed both at 3,020 transactions. This change passed both at 5,887. The simulations had comparable disk headroom but diverged in execution.