Repository navigation
Description
Problem
Since #1678 removed max_blob_size_mb, cache.cache_size_mb is the node's disk budget and the eviction driver is its sole enforcer. Enforcement is entirely after the fact: nothing reserves disk before a fill starts, so N concurrent fills can collectively commit far more than the budget and stay over it until the driver sweeps — and then until the GC sweep actually reclaims (#520).
#1678 deliberately did not build an admission controller. It shipped the instrumentation to find out whether one is needed.
Gate — do not build this until the metrics say so
Build only if, under real load:
decdn_cache_bytes + decdn_cache_fill_in_flight_bytesregularly exceedsdecdn_cache_size_limit_bytes, anddecdn_cache_pending_reclaim_bytesstays elevated across severalgc_interval_secperiods rather than spiking and draining.
If the footprint tracks the budget and pending-reclaim drains between sweeps, eviction is sufficient and this issue should be closed unbuilt. Note decdn_cache_fill_in_flight_bytes over-estimates on purpose (whole total_bytes per live session, not covered range), so it errs toward reporting pressure that has not arrived — a small excursion is not evidence.
Also check decdn_node_fill_size_*: if fills are almost all in the le_1mib bucket, no plausible burst threatens a 10 GiB budget and this is not worth building.
Design if it is warranted
A reservation charged with the signed total_bytes — a provider commits to it before delivery, so admission is a precise pre-check rather than a worst-case cap.
Charge once per hash, by refcount. Coalescing is per-hash (FillRegistry::claim), so a hash-keyed refcount reproduces "charged once" exactly. Two concurrent same-hash misses share one pull and must not double-charge; a naive per-request reservation gets this wrong and refuses the second.
Do not push it into FillRegistry::claim itself — that makes claim fallible and couples the ADR 038 registry to disk policy. A separate node-side type keyed the same way is enough, and total_in_flight_bytes() already proves the map walk.
Sketch:
pub enum AdmitDenied {
/// total_bytes alone exceeds the whole budget — no eviction or waiting helps.
ExceedsBudget { total_bytes: u64, budget_bytes: u64 },
/// Would fit an idle node; concurrent fills hold the budget.
Contended { total_bytes: u64, reserved_bytes: u64, budget_bytes: u64 },
}Check ExceedsBudget before Contended so an oversized blob always gets the durable answer regardless of current load. RAII guard released on drop, mirroring ObserverLease (fill_session.rs) — its armed flag is the pattern for making explicit release and Drop idempotent.
Wire mapping
ExceedsBudget→ServeRejectReason::BlobTooLarge→StreamError::BlobTooLarge. Already the meaning feat(node): remove max_blob_size_mb — make blob admission a disk decision #1678 gave it ("does not fit my disk budget"), and ADR 005 §Retry behavior already says do-not-retry-this-node-but-try-another.Contended→ a newServeRejectReason::DiskContended→StreamError::Overloaded. Must not collapse toNotFound(negative-cached for the full TTL) and must not reuseBlobTooLarge(a full-TTLDurableMissatnode_origin/mod.rs), which would be wrong for a load spike. The requester side already treatsOverloadedas transient — no changes needed there.
Out of scope
- The buffered miss tier's memory bound stays
cache.origin_retry.buffered_max_bytes; porting that tier to streaming is tracked separately. - On-demand GC is cache: expose manual on-demand iroh-blobs GC trigger (blocked on upstream) #520, blocked upstream.
History
Split out of #1678, which removed the memory-era blob cap and made admission a disk decision.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
refactor: drop the cache instrumentation from #1678 — out of scope
yigitdot commentedon Aug 14, 2026
Closing as won't-do.
This was gated on the instrumentation shipped in #1683 — build the reservation only if
decdn_cache_bytes + decdn_cache_fill_in_flight_bytesregularly exceeded the limit anddecdn_cache_pending_reclaim_bytesstayed elevated. That instrumentation has been removed from #1683 as out of scope for a PR about deletingmax_blob_size_mb, so there is no evidence path left to decide this.The admission model stands as the simple gate already in place: a blob is admitted if it fits
cache.cache_size_mb; eviction reconciles the rest. That is documented inadr/appendix-blob-cache-eviction.md.Reopening this needs the same thing it always did — evidence that concurrent fill bursts overshoot the budget faster than the eviction driver reclaims. The design sketch in the issue body (charge once per hash by refcount,
ExceedsBudgetbeforeContended,Overloadedrather thanNotFoundon contention) stays valid if that evidence ever shows up.