Skip to content

fix(umbp): commit to the backend outside the pool lock - #804

Merged
TianDi101 merged 2 commits into
mainfrom
fix/umbp-pool-commit-outside-lock
Oct 21, 2026
Merged

TianDi101 merged 2 commits into
mainfrom
fix/umbp-pool-commit-outside-lock

Conversation

@TianDi101

@TianDi101 TianDi101 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

PeerPool::BatchCommit held operation_mutex_ across backend->BatchCommit. For an SSD medium that call is the device write. Every exists, resolve and allocate on the node takes the same lock, so while a put was being written to SSD, lookups and reads of DRAM keys waited too.

This is what slows the one-process DRAM+SSD weighted tier. About 70% of puts land on SSD by design, and in DEP each lookup is on the scheduler's critical path.

Fix

Commit now:

  1. claims its slots under the lock,
  2. writes to the backend without the lock,
  3. relocks to record placements.

BatchResolve and Evict already use this shape. While the write runs the key stays in pending_keys_, so a racing put sees it as in flight. lifecycle_mutex_ keeps ClearLocal out.

Benchmark

Standalone server with a mixed tier (DRAM 8 GB : SSD, weights 423:1000) and 128 MiB puts. The numbers are exists latency on DRAM keys / SSD keys, as the mean of two interleaved runs per server.

writer running stock server (image 2b2671e1c) 2b2671e1c + this fix
none 0.22 / 0.51 ms 0.22 / 0.51 ms
DRAM-bound puts 0.31 / 0.61 ms 0.32 / 0.63 ms
SSD-bound puts 18.8 / 17.4 ms (p99 ~67 ms) 0.24 / 0.55 ms (p99 ≤1 ms)
mixed puts 14.7 / 14.1 ms 0.27 / 0.57 ms

Put time is unchanged (1.5 ms DRAM, 62–65 ms SSD per 128 MiB).

Tests

  • New test PeerPool.SlowCommitDoesNotBlockLookupsOrReads parks a commit inside the backend. It then checks that contains, resolve and a second put of the same key (which reports in flight) all return while the commit is parked.
  • test_peer_pool: 44/44 pass. The concurrency tests (*Slow*, *Clear*, *Concurrent*) passed 200 repeats with no failures.
  • UMBP ctest (gfx950 build): 55/55 pass. umbp_pool_client_ranges and test_transfer_engine passed 2/2 interleaved runs each, on this branch and on main 8ae8156.
  • If an abort races the commit, the backend's own claim decides the outcome. If the abort lands first, the commit fails and the key is released. If it lands after, it is a no-op, as for any committed slot.

🤖 Generated with Claude Code

TianDi101 and others added 2 commits October 19, 2026 06:32
PeerPool::BatchCommit held operation_mutex_ across backend->BatchCommit,
which for an SSD medium is the device write. Every existence check,
resolve and allocate on the node takes that lock, so a put landing on SSD
stalled lookups and reads of DRAM keys too: in a DRAM+SSD tier, exists
went from 0.2 ms to 16-18 ms mean (p99 ~63 ms, one 128 MiB put) while
SSD-bound puts ran; DRAM-bound puts caused no stall.

Commit now claims its slots under the lock, writes unlocked, and records
placements after, the shape BatchResolve and Evict already use. The key
stays reserved meanwhile, so a racing put sees it in flight, and
lifecycle_mutex_ keeps ClearLocal out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant