Skip to content

feat(umbp): one eviction path with async DRAM→SSD demotion, masterless metrics, and fixes from an e2e run - #753

Closed
TianDi101 wants to merge 21 commits into
mainfrom
feat/umbp-evict-demotion
Closed

TianDi101 wants to merge 21 commits into
mainfrom
feat/umbp-evict-demotion

Conversation

@TianDi101

Copy link
Copy Markdown
Collaborator

Supersedes #741, #742 and #683, combined into one PR, plus six fixes and one counter found by running DRAM→SSD demotion end to end under the InferenceY agentic workload. The three PRs stay open until this one lands.

Summary

Part Commits What it does
Eviction convergence (was #741) e72030f9c 1e34c2ba0 d4912e6e5 cb688e137 One eviction path. The master or a masterless node calls PeerPool::Evict per tier, each medium has a single Evict(), and nothing evicts inline on a put.
Byte-sized rounds, async demotion (was #742) 3df1165a9 518ffe10b 37728fb67 Master rounds free the whole overage instead of 32 rows. PeerPool::Evict queues the demotion on the transition worker, so EvictKey never blocks on a copy, and the per-RPC byte limit is gone.
Masterless metrics + activity summary (was #683) merge 96defc6e8 /metrics on :9092 from a standalone or embedded node, and a periodic INFO line for offload / load / evict / promote / demote.
Fixes from the e2e run 306511c06 0f54fc7b9 b8d492492 0404283c7 b1ba696b2 ff44e9c2c See below. Each one caused load or offload failures, or silent risk, in the run.
Dropped-copy counter 802915ba8 tier_transitions_total{outcome="dropped"}: evicted copies actually lost, as opposed to failed attempts a retry rescued.

The design doc, motivation and behaviour-change tables for the first three parts are unchanged from their PRs: #741 (src/umbp/doc/design-eviction-convergence.md), #742, #683.

History cleanup. #742's WIP commit and the commit that completed it (acc4b97ee + 466570e5b) are squashed into 518ffe10b, so no commit on main leaves a test failing. The diagnostic logging commit used during the e2e run is dropped. The #683 merge keeps its original conflict resolution: #741's pool-level eviction counters replace #683's PageBackend local-evict counters.

Fixes from the end-to-end run

Commit Bug Fix
306511c06 A load batch larger than the SSD staging arena failed as a whole (success=78/2664), and staging stayed held for the full 3 s read lease after the copy had finished. SsdBackend admits keys up to a per-call budget and returns kDeferred for the rest; PoolClient serves them in rounds. Local readers release staging as soon as the copy finishes (ReleaseResolved, refcounted lease tokens). The busy path undoes partial reservations. New events: staging_early_release, resolve_deferred.
0f54fc7b9 A local read was protected only by a time lease (SSD staging 3 s, DRAM/HBM fence 500 ms), so a copy that ran past it could read a reused slot or an evicted page. ResolveReader {kRemote, kLocal} on BatchResolve. Local holds are refcounted and released explicitly, never by time. The SSD reaper skips them and warns once 30 s overdue. PageBackend slots track local_readers plus a generation.
b8d492492 1.5 TB in 256 MiB segments is about 5.6k open files, against docker's soft RLIMIT_NOFILE of 1,024. Every SSD write then failed (218k), with no errno in the log. The SSD backend factory raises the soft limit to fit the planned segments (1024 → 9687 for 5591 segment files). A failed segment open logs strerror (rate-limited).
0404283c7 A transient copy, commit or verify failure during demotion dropped the evicted copy, which was the only one. TierTransitionResult::retryable; the worker re-queues retryable eviction demotions.
b1ba696b2 ShardedSsdTier::FanOutBatches wrote per-drive results into a shared std::vector<bool> from parallel threads. Bits sharing a word lost updates, so successful reads were reported as failed. Per-key std::vector<char>, published after join. Stress test included.
ff44e9c2c "No space" at an SSD target, which only means the staging arena is momentarily full, was treated as permanent. 137 keys were dropped in 30 s, just after readers had been told they existed. No-space is retryable. Eviction demotions retry for a wall-clock budget (UMBP_EVICT_DEMOTION_RETRY_MS, default 30 s), pausing 20 ms only when the queue is otherwise idle.

End-to-end validation

The InferenceY single-node agentic recipe used the config of CI run 29816: DeepSeek-V4-Pro fp4, TP8 + DP attention, MTP, conc 256, sglang umbp-linker. CI's 1.5 TB DRAM tier was replaced with 300 GB DRAM → on_evict → 1.5 TB SSD (3 NVMe drives, 4 GiB staging), on one MI355X node. The sglang launch command is byte-for-byte identical to the CI run's.

  • Attempts 1–5 each hit one of the bugs above, in that order. Attempt 6 (ff44e9c2c) completed the warmup and 3600 s of profiling with:
    • 0 failed gets, 0 SSD read or write errors, 0 SSD misses (60.4M SSD resolves), and 0 request errors.
    • 1,485,652 keys evicted from DRAM, of which 1,482,663 were demoted to SSD (99.8%). 1,493 demotion attempts failed and were retried. At the end 822 GB sat on SSD.
  • Prefix-hit rate matches CI: HBM / UMBP / miss of 33.7 / 58.3 / 8.0% against 35.1 / 57.5 / 7.3%. SSD served about half of UMBP read bytes.
  • Input throughput was 0.79× CI (281,015 vs 357,427 tok/s). sglang's scheduler spent 38% of its time in get_next_batch_to_run, against CI's 15%. SSD-backed loads take about 3.7× the server time per byte of DRAM loads, and the scheduler waits on them. Per-iteration GPU time is unchanged. This is a known limitation, listed below, not a regression.

Test plan

Known issues and follow-ups (not in this PR)

🤖 Generated with Claude Code

ditian12 and others added 21 commits September 15, 2026 14:56
…tandalone server

A UMBP peer measured everything and, without a master, published none of it.
MasterClient was the only metric destination in the process: PoolClient's
CountMetric returned early when master_client_ was null, PublishComponentMetrics
returned early for the same reason, and the component tick it drives was
registered only through MasterClient::AddMetricsProvider. The standalone server
-- the deployment sglang's direct external linker actually runs -- therefore had
no /metrics endpoint, and no flag could give it one, because the repo's only
MetricsServer instantiation is master_server.cpp's.

Introduce MetricSink as the seam between measuring and publishing. MasterClient
implements it unchanged, so with a master the metrics still go to the master --
the one behaviour this commit deliberately leaves alone. PrometheusMetricSink is
the masterless counterpart: it owns a MetricsServer in this process and stamps
the `node` label master used to add on ingest, so a dashboard query written for
a master-backed cluster works against a standalone server, and two scraped
servers do not collapse into one series.

PoolClient picks its sink once in Init, and no emission site asks about masters
again. Without a master it also starts its own tick thread, because the
component counters are published by a timer that only MasterClient previously
owned; Shutdown joins it before tearing down the backends it samples, with a
final tick so a short-lived server still publishes.

The endpoint is created only when there is no master. Its port comes from
UMBP_STANDALONE_METRICS_PORT and defaults to 9092 rather than the master's 9091,
so a node running both does not have two processes contending for one port.
0/off/false disables it; garbage is rejected loudly instead of being read as
"off", because a typo discovered as a blank dashboard days later is the failure
this is meant to prevent. A bind failure logs ERROR and continues: a server that
stores KV but cannot be scraped beats one that will not start.

The sink is injected after WithEmbeddedDefaults, not before. For a server
started with no distributed environment -- the masterless default, and the case
that needs a local endpoint most -- that function synthesizes `distributed` from
a default-constructed struct and would have silently dropped the pointer.

Tests cover the sink's counter/gauge/histogram forwarding, the node-label rules
(stamp, do not overwrite, empty means none), and the port-resolution table.

Co-Authored-By: Claude Opus 5 <[email protected]>
…dpoint reachable

Verifying the masterless metrics endpoint end to end turned up one real defect
and two missing pieces of deployment glue.

ResolveMetricsPortFromEnv used std::stol, which parses a numeric prefix and
reports success for what it read. UMBP_STANDALONE_METRICS_PORT=9O92 (letter O)
therefore resolved to port 9 -- privileged, so the bind fails, so the operator
gets no metrics and an ERROR line about a port they never typed. That is exactly
the "typo discovered as a blank dashboard days later" the resolver was written
to prevent, so it now requires the whole string to be consumed. This is what the
GarbageIsRejectedNotSilentlyDisabled test was already asserting and the only one
of the nine that failed.

Nothing told Prometheus the endpoint exists. examples/monitoring shipped one
scrape fragment, for the master's 9091, so a masterless node published on 9092
and was never scraped -- the metrics reached a port and stopped there. Add the
standalone fragment beside it, and say in the README which deployment wants
which, with the point that the dashboards do not change: they are written
against the series, and the server stamps the same `node` label the master used
to add on ingest.

UMBP_STANDALONE_METRICS_PORT was also absent from runtime-env-vars.md, where
every other UMBP knob is documented.

Verified on smci355-n09-29: a masterless standalone server (DRAM tier, no
UMBP_MASTER_ADDRESS) serves /metrics on 9092, and after 64 x 1 MiB Put + Get
through it reports backend bytes 67108864 committed and 67108864 resolved,
every series carrying node="n09-29-test". 9/9 unit tests pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
…INFO line

Answering "is this node evicting?" meant turning on DEBUG, which prints a line
per key: enough volume under steady offload to change the timing of the thing
being measured, and it drags every other DEBUG line in the process along with
it. The numbers were all being measured already -- they just had nowhere to go
in a run with no Prometheus attached, which is every run that is hard to debug:
a ctest, a one-shot benchmark, an sglang rank someone is bisecting, a customer
node.

ActivitySummary renders one window of that. It owns no thread, reads no clock
and calls no logger: it takes a cumulative snapshot and returns text, so the
deltas, the units and the idle case are unit-tested without standing up a pool.
PoolClient drives it on its own timer, in EVERY deployment -- master, masterless
or embedded -- because it is precisely the no-destination case that needs it.
UMBP_SUMMARY_INTERVAL_MS (default 60000, 0 disables); Shutdown joins it before
tearing down the backends it samples, with a final render so a run shorter than
one window still says what it did.

The vocabulary is the deployment's, not the slot lifecycle's: offload = commit,
load = resolve, evict = evict, with promote/demote the intra-pool transitions.
They are read through SampleMetrics(), not new accessors, so a new medium lands
in the summary with no code of its own; MetricPublisher is deliberately not
shared, since its delta baselines belong to the Prometheus path and one consumer
would steal the other's window.

Local eviction turned out to be invisible to metrics entirely. A page-backed
medium reclaiming to its low watermark frees pages inline instead of calling its
own Evict(), so no interface call is ever made and op="evict" stayed at zero
however much a masterless node reclaimed -- the DEBUG line was the only witness
there has ever been. PageBackend now publishes it as a medium event, which also
means it reaches Grafana for the first time.

Removed, because the summary now says the same thing better: the per-round
eviction line, and the eight per-key lines on the re-cache path. Their give-up
reasons became counters instead, which is the part DEBUG was worst at -- every
one of those paths is a best-effort return that leaves the read it was helping
perfectly correct, so a dropped re-cache was invisible unless you were already
printing a line per key. Each reason has a different fix (a bigger queue, a
wider admission policy, a larger tier), so they stay distinguishable.

An idle window still logs, carrying resident bytes and key count: a node holding
40 000 keys that moved none of them for a minute is the stall this is for, and
is indistinguishable from a healthy quiet node unless something says how much is
sitting there.

Verified on smci355-n09-29, 400 x 1 MiB into a 256 MiB tier:
  8.0s: offload 400.00 MiB/400 keys (50.0 MiB/s) · load 192.00 MiB/192 keys
        (24.0 MiB/s) miss=208 · evict 208.00 MiB/208 keys · promote 0 B · demote 0 B
    DRAM resident 192.00 MiB/256.00 MiB (75%) 192 keys
400 offloaded - 208 evicted = 192 resident = 192 loaded, and the 208 evicted are
exactly the 208 misses. 13/13 new unit tests pass.

ctest against the parent commit in the same container: 11 failures there, 10
here, the difference being test_prometheus_metric_sink, which the previous
commit fixed. No new failures. The 10 are environmental -- they die in SetUp on
"rsmi_num_monitor_devices reported 0 GPUs", this node's 8 GPUs being fully
committed to another job.

Co-Authored-By: Claude Opus 5 <[email protected]>
# Conflicts:
#	src/umbp/distributed/peer/backend/page_backend.cpp
…ut a master

Two gaps found verifying the masterless metrics endpoint against a live
Prometheus + Grafana.

Every counter series was born holding its first event.  Sources skipped
zero-valued counters and MetricPublisher only forwarded a strictly positive
delta, so a series first appeared already carrying its first burst.
Prometheus computes rate() and increase() between two samples of one series,
so that burst was invisible: after 436 keys were locally evicted,
increase(mori_umbp_backend_medium_events_total{event="local_evict"}) read 0
and the eviction panels were empty; increase() of committed keys read 1039
against 1280 actually committed.  A steady counter loses one tick, but a rare
one -- an eviction round, a no_space, a failed or rejected transfer -- loses
the whole event, and those are the ones dashboards and alerts exist for.

- MetricPublisher ships a counter the first time it sees it, even at zero.
- InstrumentedBackend publishes the (op, status) pairs each op can produce,
  plus batches/seconds/bytes, from the first tick; impossible pairs stay out.
- PageBackend publishes its local_evict counters from the first tick when
  local eviction is enabled.
- CompositeTransferEngine publishes every direction of each registered engine
  and the rejected-items counter at zero.
- PoolClient seeds the per-traffic byte counters and ranged install failures
  at zero, since those are written on the event itself.

A masterless node exported no capacity, live-key or client-count series:
the master derives them from heartbeats, so without one they did not exist
and the capacity / utilization / live-keys panels were blank.  PoolClient now
publishes them itself when there is no master, under the master's names and
labels, so the same panels read either deployment.

Tests: a first-sight zero is shipped once and not re-shipped; a fresh
backend exposes its produced pairs at zero but not impossible ones; an unused
engine reports zero-valued series.  Two tests that asserted the old
"no series until first event" shape are updated to expect zero.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
EvictionManager capped each over-full (node, tier) at evict_batch_size =
32 candidates per round, every 5 s: about 6 keys/s per tier.  At the
~0.7 MB keys of the deployment the code itself cites, that is ~4 MB/s,
so a 512 GiB tier's 0.9 -> 0.7 band took hours to drain while puts hit
NO_SPACE -- and every round still paid the store's full scan, because
both stores read every eligible row before applying the cap.  Nothing
could tune it: no flag, env var or config path set evict_batch_size.

- evict_batch_size is replaced by two byte limits:
  * max_evict_bytes_per_round (default 0 = the whole overage, already at
    most (1 - low_watermark) of the tier) caps one round per (node, tier);
  * max_evict_bytes_per_rpc (default 1 GiB) splits a node's victims into
    EvictKey RPCs by bytes as well as gRPC size, so a demoting peer -- which
    copies inside the call -- stays within UMBP_EVICTKEY_DEADLINE_MS.
  Both are env-overridable (UMBP_EVICT_MAX_BYTES_PER_ROUND / _PER_RPC).
- The store is asked for every eligible row again (max_per_bucket = 0, as
  before #540); the strategy trims to the byte budget.
- EvictionVictim carries the bytes it was charged (identity stays
  key + tier); GetEnvUint64 reads the byte limits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ey; drop per-RPC byte limit

PeerPool::Evict queues a demotion to the transition worker and returns
(PoolEvictOutcome::kDemotionQueued / kInFlight); the worker runs eviction
jobs regardless of the tier watermark and drops the copy if nothing
downstream has room. max_evict_bytes_per_rpc and EvictionVictim::bytes are
removed. Local eviction counts in-flight bytes toward its budget.

A key whose demotion copy is running holds a migration pin, and
PageBackend::EvictionCandidates used to skip every pinned key, so later
passes of the local reclaimer never saw it, could not count its bytes as
in flight, and reached past it for one more victim than the overage
needed.  Pins now record whether they are migration pins.  Candidates
still skip the SSD copy-through pin, but offer a migration-pinned key;
PeerPool::Evict reports it as kInFlight and the reclaimer counts it as
covered.  Backend Evict() still refuses every pinned key, so nothing frees
pages mid-copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The locking note still described Evict running the demotion copy itself.
Removing the per-RPC row fused two runtime-env-vars.md rows onto one line.

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

Conflicts: PageBackend's inline local-eviction round, which #683 instrumented
with its own counters (event="local_evict" under the medium-events metric), no
longer exists after the eviction convergence -- local eviction runs through
PeerPool::Evict and the backend's Evict(), which InstrumentedBackend already
counts as op="evict" (and the pool exports mori_umbp_client_local_evict_total).
Kept the convergence side, and dropped PageBackend::SampleMetrics, its four
counters, kPageBackendLocalEvictEvent and the activity summary's special case
that added them to op="evict".

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]>
…not open

SSDTier keeps every 256 MiB segment file open for the tier's lifetime, so a
full 1.5 TB tier holds ~5,900 descriptors.  Under docker's default soft
RLIMIT_NOFILE of 1,024 the e2e run's standalone server reached 1,022 open
fds with 973 segments; the next segment open failed with EMFILE and from
then on every write to the tier failed (110k demotions in ten minutes),
with nothing in the log but "backend write failed".

MakeFileSsdBackend now sizes the descriptors every file tier in the process
needs (capacity / segment size, plus each shard's active segment, plus
headroom) and raises the soft limit toward the hard one, logging an error
when even the hard limit is too small.  A failed segment open logs the path
and errno (rate-limited) instead of failing silently.

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]>
…ailed

ShardedSsdTier fans a batch out to one worker per drive and each worker
wrote its keys' results into the caller's std::vector<bool>.  The indices
are disjoint, but vector<bool> elements are not separate memory locations:
they share words, so two drives finishing together each read-modify-wrote
the word holding the other's results and could put back a stale false.  A
read or write that succeeded came back failed -- 16 and 42 times in two
DRAM->SSD demotion e2e runs, always under parallel SSD load, never
reproduced below the shard layer (SSDTier's own result paths already use
vector<char> for this reason).  The linker treats a failed get after a hit
as fatal, so each one cost a scheduler.

The workers now fill a vector<char> and the bool results are written after
they join.  The new stress test (4,096 keys over three drives, 200 batch
reads) guards the path; it does not reproduce the race, which needs two
workers' few-microsecond result loops to overlap.

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"} and shown in
the activity summary as "(N moved, M failed, K dropped)".

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