mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-29 18:10:34 +00:00
NuDB serializes every insert behind one global mutex held for the whole call, so a caller cannot see how long it waited. Record instead the writer depth joined at and the wall time spent; with mean depth L and mean insert time W, Little's Law gives service time W/L and queueing W - W/L. That distinguishes a serialized write path from a saturated disk: measured on a dev box the device sat 89 percent idle while throughput stayed flat at 42k inserts per second. The accounting runs from a ScopeExit guard because the insert can allocate and therefore throw; leaking the depth would strand the gauge above zero for the life of the process. getWriteLoad also stops returning a hardcoded zero. It now reports writer depth, which is bounded by the writing-thread count and so stays far below the kMaxWriteLoadAcquire cutoff that gates history acquisition, where returning bytes or microseconds would have silently suppressed it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>