Repository navigation
Description
Sibling axis split out of #1755 (refuse-to-serve). This is a sourcing/routing optimization, not a refusal — an origin never refuses its own namespace; its only economic knob for its own content is where to source the bytes.
The insight
An origin re-fetching its own blob from an HTTP/S3 backend pays real egress (S3 ≈ $0.09/GB). Gross client rate is ~$0.01/GB (ADR 026), so serving own content straight from S3 loses ~$0.084/GB every time. A cached copy on a peer costs protocol price (~tracks $0.01/GB) — roughly 9× cheaper than own S3 egress. The CDN economics only work because origin egress is paid once to seed, then amortized over cheap cached re-serves. So an origin should prefer pulling its own content from a cheaper cached peer over re-paying backend egress.
Free backends (FS, R2 free-egress) make this a no-op; expensive-egress backends (S3, metered HTTP) make it dominant.
Already mechanically possible
Namespace is routing-only (ADR 002; the authorized-origin serve gate was removed). Any node already pulls and serves any hash via the paid pull-through path. Content is BLAKE3-addressed and immutable, so a peer's copy of hash H is byte-identical — no freshness/staleness risk. So this needs a routing preference, not a new capability.
Proposed shape
- Model the own backend as one priced candidate with a per-origin egress cost config (
origin_egress_per_mb, default 0 = today's behavior for free backends). - On an own-namespace miss, prefer the cheapest verified source across {own backend, peers holding
H}. - Keep the backend a non-refusable seeding fallback — someone must pay to seed the first copy, and the origin is the natural seeder. Own namespace is never made unavailable.
- Opt-in per origin — some origins prefer self-sufficiency (not depending on competitors' caches) even when a peer is cheaper.
Guardrails / open questions
- Seeding economics: the first copy still costs the origin its egress; recovered as peers pull from it. Pricing that is the origin's own problem, out of scope here.
- Loop safety: ensure "prefer peer" cannot deadlock when no peer has the blob (fall back to backend).
- Interaction with Refuse-to-serve / stop-serving policy (economic, margin-based) #1755's peer-buy margin gate: reuse the same probe/rate signals; this axis chooses a source, Refuse-to-serve / stop-serving policy (economic, margin-based) #1755 declines an unprofitable relay.
Not part of #1755.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
thiras commentedon Sep 26, 2026
Closing as not planned. The saving is real but narrow, and existing rules already cover most of it. The burden is on adding a mechanism, and this one does not clear it.
Current behaviour. The miss path tries the configured origin backends first and asks paid peers only last (
crates/node/src/runtime/mod.rs, origin-chain assembly). An origin always refetches its own content from its backend. ADR 041 § Scope leaves own-namespace sourcing as a separate concern, and that stays unowned on purpose.Why it stays out
If this comes back. Only a real origin on a paid-egress backend should reopen it. The smallest version:
cache.origin_egress_per_mb, defaulting to 0 (current behaviour).min(origin_egress_per_mb, max_rate_per_mb). Put a short timeout on discovery, then fall back to the backend.