Expand description
Load-shedding: content-agnostic overload protection for the paid serve path.
When the node is saturated it refuses NEW serves — regardless of blob or
price — so in-flight streams stay fast. A refusal reuses the delivery
path’s NotFound-shaped reject, so the client re-routes (ADR 037 / #1174)
at only a latency cost; it is not slashable and carries no reputation
penalty. The decision is a pluggable LoadShedPolicy; the node wiring
layer selects the implementation from config, mirroring the ADR 040
eviction/admission policy split.
Structs§
- Always
Admit - The no-op policy: never sheds. A valid operator choice for a node that wants
no heuristic shedding. It is UNWISE under a real flood — the OS OOM-killer
becomes the only backstop — but physical limits bind regardless, and the
ConnectionLimitertask caps still apply beneath it, so the choice stays available. - Egress
Meter - Cumulative delivered bytes plus the last computed EWMA rate. All state
is atomic, so
recordstays off any lock on the hot delivery path. - Load
Shed Controller - The serve path’s load-shed handle: a swappable policy over live meters.
- Pressure
Snapshot - One immutable read of live node pressure, sampled per admission. New signals are added as fields; a policy ignores fields it does not read, so the seam is additive.
- Resource
Pressure - Sheds the miss tier under concurrency pressure and any class under egress saturation, while capping a single client’s share only during real contention. Holds one bit of hysteresis state.
- Resource
Pressure Params - Tunable thresholds, resolved from node config (see
ResolvedLoadShed). - Shed
Slot - RAII place for one admitted serve.
Dropreleases the node-wide and per-client counts on every exit path, so a finished stream always frees its slot; the count is owned here, never decremented by hand. - Shed
State - Node-wide and per-client in-flight serve counts. Held in an
Arcso aShedSlotcan outlive the borrow that created it.
Enums§
- Request
Class - Which serve tier a request falls into, resolved where
cache.hasis known. A hit is local — zero upstream cost, pure margin — so it is shed last; a miss fronts origin egress / upstream USDC and stresses disk and CPU, so it is shed first. - Shed
Decision - What a policy decided about one request.
- Shed
Reason - Why a request was shed. Metrics/observability granularity only — every
reason is
NotFoundon the wire.
Traits§
- Load
Shed Policy - A pluggable overload-protection policy.
decideis pure over the snapshot so it is unit-testable without a running node; the node wiring layer selects the implementation from config.