Skip to content

feat(umbp): a local ranged GET off SSD reads only its extent - #781

Merged
TianDi101 merged 64 commits into
mainfrom
feat/umbp-ssd-extent-staging
Oct 20, 2026
Merged

TianDi101 merged 64 commits into
mainfrom
feat/umbp-ssd-extent-staging

Conversation

@TianDi101

@TianDi101 TianDi101 commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #776 (which is stacked on #762): this needs #762's ResolveReader and read holds. The diff against feat/umbp-ssd-direct-migration is this change alone. Merge order: #783, #775, #784, #762, #776, #781; each merges cleanly in that order, and test/umbp-e2e-v9 is exactly that sequence.

Updated for #762's holds (merge 0956ea17d): #762 dropped lease tokens, ReleaseResolved and kDeferred in favour of a refcounted ResolvedEntry::hold. An extent stage now carries its own hold, and its span goes back once the last copy of that hold drops (the reaper, or the next arena acquire, collects it). Keys a local call cannot stage come back kBusy, not kDeferred.

Problem

A layer-wise restore (sglang's tree connector, UMBP_LAYER_GROUP=8) issues one BatchGetRanges per layer group, and each call asks for that group's layers of every object. On an SSD medium, SsdBackend::BatchResolve staged the whole object for every call, then dropped the lease when the call released it. Every object came off the drive once per layer group.

The prefix-hit E2E UT (DSv4, standalone server, SSD-only tier) measured, at DP 256K:

  • 17.7 GB read for 2.21 GB served, i.e. 8.0x;
  • counters single_flight_lead == staging_early_release == device_read_ok == 32,740 per load, i.e. 4,093 objects x 8 groups;
  • under TP, 8 replicas of that.

The two drives were saturated by re-reads. UMBP_LAYER_GROUP=64 cut SSD load 3.8–7.3x, which confirmed the cause, but that workaround gives up layer-wise overlap.

Change (design-ssd-ranged-io.md D1a + D1b + D1c, which land together)

  • D1a: ShardedSsdTier::ReadBatchRangesIntoPtr.
    • Keys are bucketed by drive: ONE call per drive, drives in parallel.
    • ranged_read is advertised only when every shard has it.
    • Before this, the sharded tier inherited the base class's all-false default, which reads exactly like a miss.
  • D1b: extent-scoped staging.
    • MediumBackend::BatchResolve(..., const std::vector<ObjectExtent>* extents = nullptr) takes one extent per key.
    • For an in-process (kLocal) reader, SsdBackend stages only that window:
      • widened to 4 KiB and clamped to the object, so O_DIRECT lands straight in the page-aligned span;
      • the span is private to the reader and goes back when the last hold on it drops;
      • it is never entered in read_leases_, whose entries promise the whole object.
    • ResolvedEntry gains covered_offset / covered_size; size stays the object's.
    • PoolClient::BatchGetRanges passes [first byte, last byte) of each key's ranges, then rebases them onto the window (range_map.h RebaseRangeOntoWindow) and refuses any range the window does not hold.
    • DRAM/HBM ignore extents.
    • A whole-object lease that already exists serves any window with no read.
    • Remote readers keep whole-object stages, because the extent does not cross the wire until D2.
  • D1c: extent-aware single flight.
    • PeerSsdManager::PrepareReadBatch takes optional per-key extents and lets a reader follow an in-flight read only when that read contains its window; the follower takes its own slice.
    • Coalescing on the key alone would hand one layer group another group's bytes and report success.
  • Kill switch and metrics.
    • UMBP_SSD_EXTENT_STAGING=0 restores whole-object staging. It is read at Init, and the Init line logs extent_staging=.
    • New medium counter extent_stage (events + bytes).
    • device_read bytes now count the window.

Measured

Setup: n06-21, two NVMe drives, io_uring, the masterless SSD policy the E2E server runs, driven in-process. Each load is 1,024 objects of 1.97 MB, read as 8 layer-group calls. Runs went on/off/off/on, 3 loads per run.

load (warm) per call device read / load read ÷ served bad
UMBP_SSD_EXTENT_STAGING=0 1,508–1,523 ms ~187 ms 15.00 GiB 8.0x 0
default (on) 317–318 ms ~38 ms 1.88 GiB 1.0x 0

That is 4.8x faster loads and 8x fewer device bytes.

The gain needs io_uring. Under a seccomp profile that blocks it, the tier falls back to POSIX at queue depth 1, where 256 KB extent reads run at about 0.64 GB/s per drive and the gain drops to 1.8x. The tier already warns about this at startup.

sglang E2E (DSv4, standalone server, SSD tier; DP and TP, 32K–256K; same image and node, on/off/off/on): load at 256K is 5.4x faster under DP (1,672 → 312 ms) and 6.0x under TP (10,599 → 1,753 ms), with 7.8x fewer SSD bytes in every cell and 0 bad rows. The full table is in this comment.

Dropped: pipelined local GET

An earlier second commit (359017527, UMBP_GET_PIPELINE_CHUNKS) resolved the next part of a batch while the current part was copied. It won −15% on the microbench above but was slower in every E2E cell (load 1.17–6.1x higher with 4 parts, same SSD bytes; E2E A/B), so b6bc7bc65 removes it. This PR is extent staging only.

Tests

All of these run in CI: f6c1cc29f registers test_ssd_backend, test_peer_ssd_single_flight and test_sharded_ssd_tier as umbp_* ctests. CI's -R '^(umbp_|test_dummy_ssd_tier|test_ssd_tier)' filter skipped them before.

New tests:

  • test_ssd_backend SsdBackendExtentTest x6. Asserts device_read bytes == the window:
    • a local extent resolve reads only the window;
    • tail window clamped;
    • windows of one key share a read only when identical;
    • a whole lease serves a window;
    • a remote reader stays whole;
    • kill switch.
  • test_umbp_range_map: a range inside the window is rebased; a range outside it is rejected and left untouched.
  • test_peer_ssd_single_flight:
    • disjoint extents of one key in flight together each get their own bytes (content-compared, single flight on);
    • an extent follows a whole read and takes its slice;
    • a whole read never follows an extent;
    • an extent past the object is an error.
  • test_sharded_ssd_tier: ranged reads across 4 real drives.
  • test_umbp_ssd_ranged_io: multi-page objects read layer group by layer group through the client, staged in parts, with guard bytes, and a whole read afterwards.

Current head (818462cfb, built natively):

  • 59 of 60 UMBP ctests pass under -j4.
  • umbp_cross_node_smoke aborted under -j4 and passes alone. It is a known parallel-run flake.
  • umbp_pool_client_ranges GpuRangesUseGatherKernel failed on n09-21 once another user's job held 98% of every GPU's VRAM. It passes twice on idle n08-29 (8/8 GPUs free). That test runs on the DRAM/HBM gather path, which ignores extents.

Shrink (818462cfb)

Same behavior, +1481/−102 → +913/−178:

  • PrepareReadRangesBatch folds into PrepareReadBatch(..., extents = nullptr).
  • SsdBackend keeps one ObjectExtent per read and does one dedupe lookup.
  • ShardedSsdTier's whole and ranged batch reads share one FanOutRead.
  • ObjectExtent moves to distributed/types.h.
  • Dropped: the mock-shard call-count test, the arena-fit test and a duplicate window test. Comments and the design doc are trimmed.

🤖 Generated with Claude Code

TianDi101 and others added 30 commits October 13, 2026 04:59
Eviction is decided in three places (master EvictKey, PageBackend's
masterless round, PeerSsdManager's after-write round) and freed in two
more ways than the medium's Evict (the page round's own copy of it, and
the SPDK daemon's EvictLRU). The master's request also drops the tier it
measured, so the peer frees by placement and can delete copies nobody
asked about.

The doc lays out the target: the master names (key, tier); PeerPool::Evict
is the one routing entry point both the master and a background local
eviction worker call; MediumBackend::Evict is the only code that frees a
committed key; nothing evicts on the put path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rees that copy

The master picks victims per (node, tier) but shipped only keys, so the
peer freed by placement: on a tier without on_evict offload it deleted the
key from every backend, and with copy-mode promotion (key in DRAM and SSD)
SSD pressure freed the DRAM copy and left SSD as full as before.

- EvictionVictim{key, tier}: SelectVictims and EvictKeyDispatcher carry
  the tier each victim was charged to.
- EvictKeyRequest gains `repeated TierType tiers = 2`, parallel to keys.
  An older peer ignores it; an older master sends none and the peer frees
  each key from the medium that currently holds it.
- PeerPool::Evict takes PoolEvictRequest{key, tier, backend_id} and frees
  exactly one copy: demote it when it is the placement and its tier has a
  downstream (any trigger -- on_evict vs watermark now only says whether
  the pool also offloads proactively), otherwise drop that copy only. Drops
  run outside the pool lock; lifecycle_mutex_ keeps ClearLocal out.
- A transition that lands on a parked (draining) copy promotes it to the
  durable one, so a later eviction cannot delete it as still-draining.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rough PeerPool::Evict

Before this, a committed key could be freed four ways: the master's
EvictKey (through PeerPool and the medium's Evict), PageBackend's
masterless round (its own copy of Evict's body, inline on commit),
PeerSsdManager's round (inline after every SSD write, plus
evict-then-retry on a failed write), and tier transitions.  The two
inline rounds bypassed PeerPool -- no on_evict demotion, stale placement,
invisible to InstrumentedBackend -- and the page round ran before the
pool's watermark check, so on a masterless node it deleted the cold keys
the watermark offload was about to move.

Now:
- MediumBackend::Evict is the only code that frees a committed key for
  capacity.  PageBackend::MaybeEvictToLowWatermark and
  PeerSsdManager::EvictToLowWatermark (with its watermarks, after-write
  checks and evict-and-retry) are gone; a write that does not fit fails.
- MediumBackend::EnableLocalEviction is replaced by ordering hooks that
  free nothing: TrackEvictionOrder() and EvictionCandidates(max) ->
  EvictionOffer{key, bytes}, coldest first, skipping leased/pinned keys.
- PeerPool::EnableLocalEviction(backend, high, low) starts one background
  worker.  Commits, NO_SPACE allocations and finished transitions only wake
  it; it takes offers until their bytes cover the overage and calls
  PeerPool::Evict({key, backend_id}, kReclaim) -- the call the master's
  EvictKey makes -- so a tier with a downstream demotes instead of
  deleting.  Lowest tier first, 64 keys per call, with a fixed byte budget
  as well as the live usage check.
- PoolClient enables it for every medium without a master (paged media at
  local_evict_*, SSD at its own watermarks) and for SSD with a master, as
  before.
- A demotion that loses a race to another transition no longer falls back
  to deleting the source, which could abort that transition and lose the
  key.
- mori_umbp_client_local_evict_total{event=round|key|no_candidate|stalled};
  the SSD medium's eviction_round event is gone (rounds are the pool's,
  keys and bytes are InstrumentedBackend's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With ssd_backend=spdk, PeerSsdManager reaches the device through the
spdk_proxy daemon, whose SpdkSsdTier retried a failed allocation by
dropping its own oldest keys (EvictLRU).  Nothing told PeerSsdManager:
it kept listing those keys, no REMOVE reached the master, and the master
kept routing reads to bytes that were gone.  Fragmentation could trigger
it well below the SSD watermark.

A write that does not fit now fails, as it does on the file tier, and
freeing space is the owner's local eviction, which reaches the tier
through Evict().  PeerSsdManager is the daemon's only client.

Not built by the default dev image (no SPDK); checked with a syntax-only
compile against 3rdparty/spdk/include.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PR description carries the design; the two code comments that pointed at
the doc already explain themselves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Same coverage, fewer lines:
- the SSD- and DRAM-scoped evicts of a promoted key share one test, as do
  the stale-tier and backend-scoped evicts;
- the read-recency check rides on the drain test, and the bad-config check
  on the unordered-medium one;
- the mismatched-tier-count case rides on the unscoped EvictKey test;
- the two "writes never evict" cases share one fill;
- dropped VictimCarriesTheTierItWasChargedTo (KeyOverBudgetInTwoTiers checks
  the tier on both victims) and the master-chain SSD-pressure test (the
  parked-source chain test checks the SSD victim end to end, and
  TierScopedEvictFreesOnlyThatMediumsCopy what the pool does with it);
- removed the now-unused Keys() and HasRemove() helpers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Folds #742 into this PR.

- Master: a round frees each (node, tier)'s overage in bytes, optionally
  capped by UMBP_EVICT_MAX_BYTES_PER_ROUND, instead of 32 candidates per
  bucket -- which freed a few MB per round and took hours to drain a
  512 GiB tier's 0.9 -> 0.7 band.  The store returns every eligible row and
  the strategy trims to the budget.
- Peer: PeerPool::Evict queues a demotion on the transition worker instead
  of running the copy inside the EvictKey RPC, so the call never waits on
  bytes.  Each result carries an outcome (freed, demotion queued, in
  flight).  The worker runs an eviction's demotion whatever the tier's own
  watermark says, and drops the copy if nothing downstream can take it.
- Local eviction counts queued demotions toward its budget (a migration pin
  no longer hides a key from EvictionCandidates), so a pass never queues
  more than the overage while the copies run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… tests

Comments: drop history and restated rationale (the commit message has it).

Tests, same coverage with fewer of them:
- The two GetEnvUint64 tests become one.
- Drop LruMasterEvictStrategy.ABudgetLargerThanAnyRowCapIsMetInOneRound:
  the strategy never had a row cap (the manager did), and it is unchanged.
- The three MasterEvictionBytes tests become one, which also reads the
  limit through UMBP_EVICT_MAX_BYTES_PER_ROUND.
- EvictReturnsBeforeTheDemotionCopyRuns folds into
  OnEvictMigratesBytesToConfiguredBackend, and
  QueuedDemotionsCountTowardTheBudget into the local-eviction demotion test
  (now ATierWithADownstreamDemotesJustTheOverage).
- GatedEngine's hold times out after 10 s, so it needs no ReleaseOnExit
  guard to keep a failed test from hanging teardown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment-only.  Drops narrative and rationale that restates the code, and
the same "the pool decides, the medium only supplies order" paragraph that
was repeated across several headers; field and helper docs become trailing
one-liners.  Added comment lines across the PR: ~400 -> 195.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With a master, a node can evict at its own watermarks instead of waiting
for the master's EvictKey rounds, while still taking its victims from the
master's cluster-wide recency.

- Master: new GetEvictionCandidates RPC returns a node's keys on one medium
  (optionally one logical tier), least recently accessed first, until their
  sizes cover the requested bytes; master-leased keys are skipped.
  RegisterClient and every Heartbeat carry peer_driven_eviction, and
  EvictionManager leaves such nodes out of its rounds (in memory only).
  ClientRegistryConfig::advertise_peer_driven_eviction gates both.
- Peer: local eviction asks a candidate source first (at most once per
  200 ms per backend), rounds its value sizes up to the backend's pages,
  evicts through PeerPool::Evict, and covers the rest from the medium's own
  LRU.  In peer-driven mode PoolClient runs local eviction for every medium,
  at a tiered policy's per-tier watermarks when there is one.
- Opt-in: PoolClientConfig::peer_driven_eviction or
  UMBP_PEER_DRIVEN_EVICTION=1, and only once the master confirms support;
  otherwise behaviour is unchanged.  New metric event master_key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replaces the peer_driven_eviction switch with PoolClientConfig::eviction_mode
(env UMBP_EVICTION_MODE), which says how a node with a master evicts:

- local (default): every medium at the node's own watermarks, by its own
  LRU, without asking the master.
- master_ranked: the same, with victims ranked by the master
  (GetEvictionCandidates), falling back to local LRU.
- master: DRAM/HBM wait for the master's EvictKey rounds; SSD still evicts
  locally (the previous behaviour).

A self-evicting node (local or master_ranked) asks the master to leave it
out of its rounds; every mode still serves EvictKey, so the master can evict
on demand.  A node without a master evicts locally as before.  Self-evicting
nodes use a tiered policy's per-tier watermarks when there is one.

Tests that fill tiny tiers on purpose (cross-node smoke, tier benchmark)
now run in master mode, the behaviour they were written against.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two ways a local read of SSD-resident keys failed although every key was
on the device, both seen in the DRAM->SSD demotion e2e run (DSv4-Pro,
sglang direct linker, 300 GB DRAM + 1.5 TB SSD):

* A resolve batch needing more staging than the whole arena failed outright
  ("batch requires 77580 staging pages but arena has 65536; not retryable"),
  however long the caller waited.  The linker's layer-wise reads asked for
  ~2.6k objects per call, so every such call failed.
* Staging was only ever freed by the read lease's expiry (3 s): no local
  reader released it, so the arena had to hold read_rate x 3 s -- ~27 GiB at
  the 9 GiB/s the run reached.

Now:
* SsdBackend::BatchResolve stages at most half the arena per call and
  returns the rest as ResolveOutcome::kDeferred -- held, readable, resolve it
  in a further call.  The first key is always taken, so a batch progresses.
  PeerPool keeps deferred keys' placements; on the wire a deferral is a
  failure (a remote reader cannot come back for the rest).
* MediumBackend::ReleaseResolved hands staging back as soon as the reader's
  copy is done.  Leases are refcounted per published entry and carry a token
  (ResolvedEntry::lease_token), so a shared lease outlives its first reader
  and a release arriving after expiry cannot free the successor's pages.  A
  BUSY resolve drops the holders it took, since the caller discards it.
  Readers that never release (peers over the wire) still expire as before.
* PoolClient's local readers (BatchGetRanges, ServeLocalGets) run resolve ->
  copy -> release in rounds until nothing is deferred; ExecuteLocalGet and
  the two medium existence probes release what they staged.
* InstrumentedBackend counts a kFailed resolve as failed instead of a miss,
  and does not count kBusy/kDeferred (the retry is counted).
* New SSD medium events: staging_early_release, resolve_deferred.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A resolve's read lease protected its bytes for a fixed window (SSD staging
3 s, DRAM/HBM pages 500 ms) whoever the reader was.  For an in-process
reader that is a use-after-free waiting to happen: a copy that outlives the
window has its staging reclaimed (SSD) or its pages evicted (DRAM/HBM) and
reused while it is still reading them.  The timer exists for peers reading
over the wire, which cannot report completion; a local reader can.

BatchResolve now takes a ResolveReader (kRemote by default, the one that
cannot leak).  A kLocal reader always hands its entries back with
ReleaseResolved, and until it does:
* SsdBackend counts it in the lease's local_holders; the reaper skips such
  a lease past expiry (warning once at 30 s overdue).  Remote holders keep
  the old expiry, so a lease a peer touched still waits for its timer after
  the local reader releases.
* PageBackend counts it in the slot's local_readers, which fences Evict,
  eviction candidates and the local reclaimer like a live lease.  Releases
  carry the slot generation as their token.
PoolClient resolves its local reads as kLocal and releases on every path:
the busy retry gives back a discarded response's holds, the read rounds
release from a scope guard, and an existence-only ResolveLocalBatch caller
releases at once.  PeerPool forwards the reader and gains ReleaseResolved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The transition worker dropped an evicted copy on ANY failed demotion.  That
is right when nothing downstream has room -- the tier must still free -- but
a copy, commit or read-back failure on a target that had room is a fault on
the way, and the evicted copy is the only one: dropping it turned a burst of
3,934 transient SSD write failures into 3,934 lost keys in the e2e run.

TierTransitionResult::retryable marks those failures; the worker requeues
such an eviction demotion (up to 3 more attempts, at the back of the queue,
so it runs after the backlog) and drops the copy only after that, or when no
target had room.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…opping

When a demotion's target answered "no space" the transition worker dropped
the evicted copy at once -- the only copy.  For an SSD target "no space"
only ever means its staging arena is momentarily full of in-flight reads
(BatchAllocate does not check device capacity), so under heavy read load
the e2e run lost 137 keys in one 30 s window, each of which a reader had
just been told was present: its next get failed.

No space at a target is now retryable, and a retryable eviction demotion
is retried for a wall-clock budget (UMBP_EVICT_DEMOTION_RETRY_MS, default
30 s, from its first attempt) instead of a fixed count, which a short queue
burned in milliseconds.  A retry pauses 20 ms only when nothing else is
queued, so it neither spins nor holds up other transitions.  The copy is
still dropped once the budget is spent, or at once when the target can
never take the key, so a source tier always frees.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`failed` counts every failed transition attempt, including ones a retry
later rescues, so it cannot tell a pressure burst from lost keys.  The
pool now counts each evicted copy it actually drops -- the demotion could
not land within its retry budget, or never could -- as
TierTransitionMetrics::dropped, exported as
mori_umbp_client_tier_transitions_total{outcome="dropped"}.  The activity
summary's "K dropped" comes with #683, which adds that summary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment-only, plus ProbeLocal for the two resolve-and-release probes that
were written out twice.  ResolveReader now sits above ResolveOutcome's
comment instead of between it and its enum.  The SSD backend tests fold
from eight to five (one shared-lease test, one remote-expiry/stale-token
test) and the PageBackend pair into one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment-only, plus one anonymous namespace instead of two back to back.  The
transient- and persistent-failure tests become one (retried until it lands;
dropped once the budget runs out).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The master ranks a node's keys by last_accessed_at, which only RouteGet
updates.  A local_first node serves its hits without the master, so under
master_ranked (and master) the hottest keys looked the coldest and went
first: in a 4 GB DRAM / 8 GB SSD smoke a hot set re-read throughout the
fill survived 0/512 under master_ranked vs 512/512 under local, and the
hot reads then served from SSD slowed demotion until DRAM sat at 100%.

A node whose eviction follows the master's recency now ships the keys it
reads locally (deduped, bounded) on its heartbeats, and the master
records an access for each.  Local mode sends nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al-leases

Picks up #741's local-read reports; ResolveLocalBatch keeps this branch's probe release and deferred keys alongside them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Picks up #741's local-read reports.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
master_ranked asked GetEvictionCandidates synchronously inside the
eviction pass, at most every 200 ms per backend.  The in-memory master
answers by scanning its whole index; at e2e scale (500k DRAM + 2.7M SSD
keys on one node) that is 0.66 s per DRAM query and 1.9 s per SSD query,
so a DRAM pass stalled most of every second and every SSD query hit the
1 s deadline and was thrown away after the master had done the work.

The pass now waits at most 20 ms for the query it sends (a small index
still answers the same pass); a slower answer serves a later pass unless
it is over 3 s old, and the medium's own order evicts meanwhile.  One
query per backend is in flight at a time.  The deadline goes to 3 s to
match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al-leases

Picks up #741's non-blocking ranked queries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Picks up #741's non-blocking ranked queries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One pass reclaims a backend's whole watermark band: in the e2e a single
DRAM pass covered 108k keys, while one GetEvictionCandidates answer
carries at most 4096 and arrives after the pass has moved on.  The pass
asked once, at its start, so master_ranked ranked 0 of those 108k
victims (at most 4% even when it used to wait for the answer).

The pass now takes the master's answer whenever it is ready, and asks
again for what the budget still needs as each answer runs out (still at
most one query per 200 ms per backend); the medium's own order evicts in
between.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…al-leases

Picks up #741's whole-pass master ranking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Picks up #741's whole-pass master ranking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The branch already carries #741's head e8b950a, which bb6af32 squashes
onto 38a4fa3, so the tree is kept as is.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict with #758 in BatchGetRanges: #758 replaced the local_items vector
with an incremental plan builder, and this branch splits the local phase into
resolve -> copy -> release rounds.  Each round now gets its own builder, since
its copies must finish before its holds are released.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TianDi101 and others added 2 commits October 16, 2026 04:38
… this part's copy

BatchGetRanges' local phase was resolve -> plan+copy -> release, one stage at
a time. On SSD the resolve is the device read into the staging arena, so the
H2D copy sat on the critical path after every read.

Cut the local phase into up to UMBP_GET_PIPELINE_CHUNKS parts (default 4, at
least 32 keys each) and resolve part k+1 on a helper thread while part k is
planned and copied. Holds are per part and released before waiting on the next
part, so a concurrent resolve that hits BUSY on a held arena retries until that
copy finishes rather than deadlocking. Deferred keys requeue at the back, and a
part still resolving on an exceptional exit is drained and released. CHUNKS=1,
or a batch under 64 keys, is the old loop. The debug line's resolve is now the
time the caller waited on a resolve, so the phases still sum to total.

Layer-wise microbench (n06-21, 1024 x 1.97 MB, 8 groups, GPU dst, 2 x 7450,
D1 on), steady state: 324 -> 275 ms per load (-15%), 37.9 -> 32.5 ms per call,
same 1.88 GiB off disk, 0 bad bytes.

Test: PipelinedLocalGetOfABatchFarLargerThanTheArenaIsServedInFull (128 keys
vs an 8-page arena, CHUNKS 4/1/4). Docs: design-ssd-ranged-io.md §4.6,
runtime-env-vars.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The segment-file tier ranks eviction by its own index, whose recency only
reads through the tier refreshed. LocateRecord, the path GDS reads and
in-place promotions take, did not touch it, so under on_read the SSD
evicted in write order whatever was read. With promote_mode move a load
that promoted a page's c4 objects left their segment mostly dead and still
"cold", so it went next, taking the same pages' indexer objects before the
load read them (an e2e run lost 1,793 of 1,796 keys in one get and sglang
died).

LocateRecord now touches the key like any read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TianDi101 TianDi101 changed the title feat(umbp): a local ranged GET off SSD reads only its extent feat(umbp): a local ranged GET off SSD reads only its extent, and overlaps the next read with the copy Oct 16, 2026
BatchResolve now counts a held-but-unreadable key as status="failed"
instead of a miss, but kProduces still marked resolve/failed as never
produced, so SampleMetrics skipped the series.  Those keys left "miss"
and showed up nowhere: the backend panel read zero resolve failures and
its hit ratio left them out of the denominator.  Mark the pair produced,
so it is published from the first tick like every other series.

Tests: a scripted MockBackend checks that kFailed/kBusy/kDeferred/missing
count as failed/nothing/nothing/miss, and the failed series exists at
zero before its first event.  Both fail with the table unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TianDi101

Copy link
Copy Markdown
Collaborator Author

E2E A/B: extent staging (first commit)

Setup:

Columns:

  • TTFT: time to first token on a UMBP hit, one value per arm (A / B).
  • load: that TTFT minus the TTFT of a GPU-resident hit, median of the two arms.
  • read: SSD bytes per load, from block-layer counters.
par length TTFT off (A / B) TTFT on (A / B) load off load on speedup read off → on
DP 32K 293 / 294 ms 157 / 155 ms 143 ms 6 ms — 2.05 → 0.26 GiB
DP 64K 508 / 509 168 / 168 359 19 — 4.11 → 0.53
DP 128K 948 / 946 262 / 264 799 114 7.0x 8.23 → 1.06
DP 256K 1,830 / 1,829 466 / 476 1,672 312 5.4x 16.48 → 2.12
TP 32K 1,509 / 1,515 345 / 346 1,378 210 6.6x 16.37 → 2.10
TP 64K 2,801 / 2,815 547 / 550 2,672 412 6.5x 32.87 → 4.22
TP 128K 5,439 / 5,433 993 / 991 5,292 851 6.2x 65.87 → 8.45
TP 256K 10,747 / 10,762 1,906 / 1,909 10,599 1,753 6.0x 131.87 → 16.92
  • Disk bytes drop 7.8x in every cell, the 8x layer-group re-read removed.
  • Load and bytes do not drop by the same factor at the long lengths, because the remaining read is now one pass at the drives' bandwidth. At 32K–64K DP the extent fits so easily that load nearly vanishes (6 ms and 19 ms).
  • The two arms of each setting agree within ~1%, and every arm has 0 bad rows and 0 incomplete.
  • A DP DRAM arm with extent staging on is normal (load 43 ms at 256K, 0 bad); DRAM ignores extents.
  • TP still reads 8x DP's bytes, because each of the 8 ranks reads its own copy of the replicated MLA KV. That is a separate issue from this PR.

Overlap A/B (second commit): the UMBP_GET_PIPELINE_CHUNKS 4 vs 1 arms did not run on this job. The node's kubelet hit disk pressure and garbage-collected the unused overlap image 2.5 min after it was loaded. They are re-queued, with the image pinned, and the results will follow here.

🤖 Generated with Claude Code

TianDi101 and others added 4 commits October 16, 2026 10:12
…-read-touch

# Conflicts:
#	src/umbp/include/umbp/local/tiers/sharded_ssd_tier.h
#	src/umbp/include/umbp/local/tiers/ssd_tier.h
#	src/umbp/local/tiers/sharded_ssd_tier.cpp
…local-leases

# Conflicts:
#	src/umbp/distributed/pool_client.cpp
A local reader now protects what it resolved by keeping a shared_ptr hold
(ResolvedEntry::hold). The bytes stay put while any hold lives and come back
when the last one drops. This replaces the lease tokens, generations,
ReleaseResolved and kDeferred that the first version of this PR added.

- PageBackend: each committed slot owns a hold. Evict, EvictionCandidates and
  ClearLocal skip a slot whose hold is shared. A kLocal resolve takes no lease.
- SsdBackend: a staging span is reclaimed once its lease has expired and its
  last hold is gone. Reclaim runs in the reaper and on demand when staging is
  full. A kLocal batch is staged up to half the arena at a time; the rest
  comes back kBusy, and the caller serves it in further parts. A kRemote batch
  keeps all-or-nothing staging.
- PeerPool: a partial kLocal batch still touches and promotes what it served.
- PoolClient: ServeLocalGets and BatchGetRanges drop each part's holds before
  resolving the next part. The probes use BatchContains, so they stage nothing.

Also fixes test_peer_pool's FailingEngine to override CreatePlanBuilder
(#774's interface). Before this, test_peer_pool did not build on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
TianDi101 and others added 5 commits October 16, 2026 10:19
…irect-migration

# Conflicts:
#	src/umbp/distributed/peer/backend/ssd_backend.cpp
#	src/umbp/distributed/pool/peer_pool.cpp
#	src/umbp/distributed/pool_client.cpp
#	src/umbp/include/umbp/distributed/peer/backend/ssd_backend.h
#	src/umbp/include/umbp/distributed/types.h
#	src/umbp/include/umbp/local/tiers/ssd_tier.h
#	src/umbp/local/tiers/ssd_tier.cpp
#	tests/cpp/umbp/distributed/test_peer_pool.cpp
#	tests/cpp/umbp/distributed/test_ssd_backend.cpp
#	tests/cpp/umbp/distributed/test_transfer_engine.cpp
…ect-migration

Brings in #775 (segment reclaim) and #784, which this PR now merges after.
A reserved record's value is written through its segment's fd outside the
lock, so Reserve/Commit/AbortRecord pin that segment (and the replaced
record's) until the reservation ends, as Write does; a sharded reserve
refreshes its placement hints like a sharded write.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
#774 made Plan() a non-virtual wrapper over CreatePlanBuilder().  PosixEngine
keys plans by (memory, file range, direction) because a file endpoint has no
host_ptr, so it gets its own builder rather than PairPlanBuilder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nt-staging

Moves extent staging and the pipelined local get onto #762's holds: an extent
stage keeps a hold and is reclaimed with the read leases once the last one
drops; a pipeline part's holds live in its Stage, so the release paths (scope
guards, drain-ahead) are gone.  Brings in #775, with whose ShardedSsdTier
capabilities the ranged_read check is combined.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TianDi101

Copy link
Copy Markdown
Collaborator Author

E2E A/B: pipelined GET (second commit). Slower in every cell; the default of 4 should not merge

Setup: the same as the extent-staging A/B above, with extent staging on in every arm. Only UMBP_GET_PIPELINE_CHUNKS changes between arms.

  • One node (n09-33, job 2310), in 4/1/1/4 order, 5 reps per length.
  • The image was built from 359017527, before the holds port. b67f13608 has the same split-and-resolve-ahead loop.
par length TTFT chunks=1 (A / B) TTFT chunks=4 (A / B) load 1 load 4 load 4 ÷ 1
DP 32K 158 / 153 ms 160 / 162 ms 4 ms 10 ms 2.5x
DP 64K 166 / 165 250 / 245 16 98 6.1x
DP 128K 255 / 262 364 / 359 110 215 2.0x
DP 256K 461 / 468 579 / 565 306 415 1.36x
TP 32K 396 / 381 552 / 537 253 411 1.6x
TP 64K 549 / 551 843 / 857 414 714 1.7x
TP 128K 993 / 989 1,314 / 1,317 848 1,173 1.4x
TP 256K 1,913 / 1,885 2,212 / 2,190 1,746 2,047 1.17x
  • 4 parts is slower in every cell. SSD bytes are identical (2.12 GiB DP 256K, 16.92 GiB TP 256K), every arm has 0 bad rows and 0 incomplete, and the two arms of each setting agree.
  • chunks=1 matches the first commit alone (DP 256K load 306 ms vs 312 ms above).
  • It is not the staging arena. No arm logged an arena BUSY or a rollback.

Where the time goes (server metrics, summed over the four lengths, mean of the two arms):

chunks=1 chunks=4
SSD resolve time, DP 2.80 s 4.27 s 1.5x
SSD resolve time, TP 122 s 170 s 1.4x
HBM copy submissions, DP 3.8k 10.2k 2.7x
HBM copy submissions, TP 30.8k 84.1k 2.7x
  • The loop keeps only one read in flight. Part k+1 is read while part k is copied, and part k+2 starts only after part k+1 is back. A call's single batched read becomes up to four smaller reads, one after another, and the same bytes now take 1.4–1.5x longer to read.
  • Each part plans and copies on its own, hence 2.7x more copy submissions.
  • There is not much to hide in E2E. After extent staging the copy is ~15% of a DSv4 call (~2 of ~13 ms). On the microbench it was ~29% (11 of 37.9 ms), which is why 4 parts won there. Splitting the read costs more than the hidden copy saves.
  • Not broken down yet: how the fixed costs of each extra part (thread start, resolve setup, staging) split. That is the part that makes DP 64K 6x slower.

The first commit's result stands: it is measured with chunks=1 here as well. Whether the second commit stays with a default of 1 or comes out of this PR is still open.

🤖 Generated with Claude Code

…o end

3590175 cut BatchGetRanges' local phase into UMBP_GET_PIPELINE_CHUNKS
parts (default 4) and resolved part k+1 while part k was copied.  It won
-15% on the single-caller layer-wise microbench, but in the DSv4 prefix-hit
E2E (n09-33, 4/1/1/4 arms, same SSD bytes, 0 bad) it was slower in every
cell: load 1.17-6.1x higher with 4 parts than with 1.

The loop keeps one resolve in flight, so a call's single batched SSD read
became up to four smaller reads back to back: 1.4-1.5x more resolve time
for the same bytes and 2.7x more copy submissions.  After extent staging
the copy is only ~15% of an E2E call, so there is less to hide than the
split costs.

Restore the one-stage resolve -> copy -> release loop.  Extent staging is
unchanged.  Removes UMBP_GET_PIPELINE_CHUNKS, design-ssd-ranged-io.md 4.6
and PipelinedLocalGetOfABatchFarLargerThanTheArenaIsServedInFull.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@TianDi101 TianDi101 changed the title feat(umbp): a local ranged GET off SSD reads only its extent, and overlaps the next read with the copy feat(umbp): a local ranged GET off SSD reads only its extent Oct 16, 2026
@TianDi101

Copy link
Copy Markdown
Collaborator Author

Removed the pipelined local GET in b6bc7bc65 (a revert commit on top of b67f13608, no force-push), per the E2E A/B above. The BatchGetRanges loop is back to one resolve → copy → release round at a time. Extent staging is unchanged. UMBP_GET_PIPELINE_CHUNKS, design doc §4.6 and its test are gone. The focused ctest set (19 tests) passes.

Note: test/umbp-e2e-v9 still contains the pipelined GET; it was built before this commit.

🤖 Generated with Claude Code

TianDi101 and others added 2 commits October 16, 2026 15:24
Same behavior, about 600 fewer lines:
- PeerSsdManager::PrepareReadRangesBatch folds into PrepareReadBatch,
  which takes optional per-key extents; the dead FollowerTarget::cap goes.
- SsdBackend keeps one ObjectExtent per read and one dedupe lookup;
  ExtentStage holds an ObjectExtent window.
- ShardedSsdTier's whole and ranged batch reads share one FanOutRead.
- ObjectExtent moves to distributed/types.h.
- Tests: drop the mock-shard call-count test and the arena-fit test,
  merge the two same-key window tests, and fold the range-map tests to
  two. Comments and the design doc trimmed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	src/umbp/distributed/peer/backend/instrumented_backend.cpp
#	src/umbp/distributed/peer/backend/page_backend.cpp
#	src/umbp/distributed/peer/backend/ssd_backend.cpp
#	src/umbp/distributed/peer/ssd/peer_ssd_manager.cpp
#	src/umbp/distributed/pool/peer_pool.cpp
#	src/umbp/distributed/pool_client.cpp
#	src/umbp/include/umbp/distributed/peer/backend/instrumented_backend.h
#	src/umbp/include/umbp/distributed/peer/backend/medium_backend.h
#	src/umbp/include/umbp/distributed/peer/backend/mock_backend.h
#	src/umbp/include/umbp/distributed/peer/backend/page_backend.h
#	src/umbp/include/umbp/distributed/peer/backend/ssd_backend.h
#	src/umbp/include/umbp/distributed/pool/peer_pool.h
#	src/umbp/include/umbp/distributed/pool_client.h
#	src/umbp/local/tiers/sharded_ssd_tier.cpp
#	tests/cpp/umbp/distributed/test_component_metrics.cpp
#	tests/cpp/umbp/distributed/test_peer_pool.cpp
@TianDi101
TianDi101 changed the base branch from feat/umbp-ssd-direct-migration to main October 16, 2026 16:06
@TianDi101 TianDi101 closed this Oct 20, 2026
@TianDi101 TianDi101 reopened this Oct 20, 2026
… in CI

CI's UMBP step runs ctest -R '^(umbp_|test_dummy_ssd_tier|test_ssd_tier)',
so tests registered as test_* were built but never run -- including this
PR's extent tests in test_ssd_backend, test_peer_ssd_single_flight and
test_sharded_ssd_tier.  Register those three as umbp_*; the executables
keep their names.

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