Skip to content

docs(adr): add blob cache eviction policy as appendix - #444

Merged
alpergundogdu merged 1 commit into
mainfrom
docs/adr-030-blob-cache-eviction-policy
May 7, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
docs/adr-030-blob-cache-eviction-policy

Conversation

@thiras

@thiras thiras commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add appendix-blob-cache-eviction.md codifying the blob cache eviction policy: LRU keyed on the timestamp of the last successful CacheEngine::get (refreshed on both the cache-hit path and the post-pull-through path), with operator pinning overriding LRU, durable operator-initiated evict orthogonal to LRU, and the probe-hold mechanism in ADR 005 composing above LRU. Reputation does not factor into eviction.

Filed as an appendix per the cut-line in adr/README.md § ADRs vs appendices: blob cache eviction is a node-internal choice (two nodes running different eviction strategies still interoperate as long as they honour the probe-triggered hold), which puts it on the appendix side. Mirrors the same reclassification #448 applied to peer-table eviction.

Closes #220, #447 part 2.

Changes

  • New: adr/appendix-blob-cache-eviction.md. Standard appendix preamble; sections for Eviction key, Pinning, Operator-evict, Probe-hold integration, Reputation, Observability; rejected-alternatives covers LFU, size-weighted, hybrid LRU+LFU, no-eviction, reputation-priority, and probe-refresh.
  • adr/architecture.md: add to Appendices — Reference Patterns; § Caching eviction wording narrowed from "LRU or frequency-weighted (LFU)" to point at the appendix.
  • adr/005-protocol.md: probe-hold paragraph narrowed from "LRU/LFU" to "LRU" pointing at the appendix.
  • adr/appendix-observability.md § 2.3 Cache Metrics: three new rows — decdn_cache_size_limit_bytes (Tier R), decdn_cache_evicted_operator_total (Tier R), decdn_cache_pinned_count (Tier R); tighten decdn_cache_evictions_total description from "LRU/LFU" to "LRU".
  • adr/README.md: pandoc reading-order book build adds the new appendix after appendix-peer-table-eviction.md.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 6, 2026 20:50

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces ADR 030, which codifies the Blob Cache Eviction Policy using a Least-Recently-Used (LRU) approach. It details how eviction interacts with operator pinning, durable operator-initiated evictions, and probe-triggered holds, while also defining new observability metrics. Feedback focuses on maintaining the canonical nature of the documentation by removing historical narratives, implementation status, and GitHub issue references from the ADR and architecture files, as well as correcting several internal Markdown anchor links.

Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/architecture.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new normative ADR (ADR 030) to formalize the blob cache’s eviction behavior as LRU and to document how pinning, operator-initiated eviction, and probe-hold exemptions compose with that policy. Updates the architecture overview, protocol ADR, observability appendix, and ADR book build order to reference and incorporate ADR 030.

Changes:

  • Add ADR 030 specifying LRU eviction semantics and interactions (pinning, operator-evict, probe-hold, and observability expectations).
  • Update architecture/protocol ADRs to replace “LRU/LFU” ambiguity with ADR 030 references.
  • Update the ADR reading-order book build and observability cache-metrics table to include ADR 030 and related metrics.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
CLAUDE.md Bumps “next ADR number” to 031 after adding ADR 030.
adr/README.md Inserts ADR 030 into the reading-order pandoc build list.
adr/architecture.md Adds ADR 030 to reading order and index; updates cache eviction description to point at ADR 030.
adr/appendix-observability.md Updates cache metrics table to reference ADR 030 and adds cache-size-limit / pin / operator-evict metrics entries.
adr/030-blob-cache-eviction-policy.md New ADR defining blob cache eviction policy contract and interactions.
adr/005-protocol.md Updates probe-hold wording to reference LRU (via ADR 030) rather than “LRU/LFU”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
Comment thread adr/architecture.md Resolved
Comment thread adr/architecture.md Resolved
Comment thread adr/030-blob-cache-eviction-policy.md Resolved
@alpergundogdu

Copy link
Copy Markdown
Contributor

Code review

Found 1 issue:

  1. The new metric decdn_cache_size_limit_bytes is added at Tier M (Mandatory), but the appendix's own tier definition restricts M to "slash-risk conditions and delivery accountability" — and the metric is a static configuration mirror (cache.cache_size_mb × 1 048 576) with no slash-risk or delivery-accountability surface. The other two new cache metrics added in the same PR (decdn_cache_evicted_operator_total, decdn_cache_pinned_count) are correctly classified at Tier R, suggesting R is the intended tier here too.

    Definition (line 41):

    **Mandatory (M):** The node MUST expose these metrics or refuse to start. They cover slash-risk conditions and delivery accountability.
    **Recommended (R):** The node SHOULD expose these metrics. Absence is not a startup blocker, but operators lose visibility into specific subsystems.

    New row (line 84):

    |--------|------|------|-------------|
    | `decdn_cache_bytes` | Gauge | M | Current total cache size in bytes (all blobs). Paired with `decdn_cache_size_limit_bytes` for a saturation ratio. |
    | `decdn_cache_size_limit_bytes` | Gauge | M | Configured cache capacity in bytes (`cache.cache_size_mb × 1 048 576`). See [ADR 030](030-blob-cache-eviction-policy.md). |
    | `decdn_cache_hits_total` | Counter | M | Probe or stream requests satisfied from local cache. |
    | `decdn_cache_misses_total` | Counter | M | Probe or stream requests requiring origin pull or peer pull. |
    | `decdn_cache_evictions_total` | Counter | R | Blobs evicted by LRU pressure (the eviction-driver loop). See [ADR 030](030-blob-cache-eviction-policy.md). |
    | `decdn_cache_evicted_operator_total` | Counter | R | Hashes removed via `decdn node evict` (durable, persisted to `<cache_dir>/evicted.log`). Distinct from `decdn_cache_evictions_total`. See [ADR 030 §3](030-blob-cache-eviction-policy.md). |
    | `decdn_cache_pinned_count` | Gauge | R | Size of the operator-pinned set (operator-managed exemption from LRU). See [ADR 030 §2](030-blob-cache-eviction-policy.md). |
    | `decdn_probe_post_eviction_failures_total` | Counter | R | `EvictedSinceProbe` responses received from remote nodes during cache-hit stream requests. A sustained rate above ~1% of cache-hit attempts suggests remote hold mechanism failures ([ADR 001](001-network.md), [ADR 005](005-protocol.md)). |

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@alpergundogdu alpergundogdu changed the title docs(adr): add ADR 030 blob cache eviction policy docs(adr): add blob cache eviction policy as appendix May 7, 2026
New appendix codifying LRU eviction for the blob cache, the
operator-pinning override, the durable operator-evict orthogonality,
and the probe-hold composition above LRU. Closes #220.

Per the cut-line in adr/README.md § ADRs vs appendices, ADRs codify
cross-implementation interop contracts; local implementation policies
that any compliant node may set independently belong in appendices.
Blob cache eviction is a node-internal choice — two nodes running
different eviction strategies (LRU, LFU, hybrid) still interoperate
so long as they honour the probe-triggered hold in ADR 005. PR #448
applied the same logic to peer-table eviction; this PR mirrors that
reclassification for the blob cache.

Changes:

- adr/appendix-blob-cache-eviction.md: new file. LRU keyed on the
  Instant of the last successful CacheEngine::get (refreshed on both
  the cache-hit path and the post-pull-through path); pinning, evict,
  and probe-hold compose above it; reputation does not factor in.
  Six-section structure (Eviction key / Pinning / Operator evict /
  Probe-hold / Reputation / Observability) plus rejected alternatives
  (LFU, size-weighted, hybrid LRU+LFU, no-eviction, reputation-priority,
  probe-refresh).
- adr/architecture.md: add the new appendix to "Appendices — Reference
  Patterns" between peer-table eviction and L2 deployment; update
  § Caching eviction wording from "LRU or frequency-weighted (LFU)" to
  "LRU keyed on the timestamp of the last successful CacheEngine::get"
  pointing at the appendix.
- adr/005-protocol.md: probe-hold paragraph narrowed from
  "LRU/LFU cache pressure" to "LRU cache pressure" pointing at the
  appendix. Aligns with the canonical decision to specify LRU.
- adr/appendix-observability.md § 2.3 Cache Metrics: add three rows
  (decdn_cache_size_limit_bytes Tier R; decdn_cache_evicted_operator_total
  Tier R; decdn_cache_pinned_count Tier R) and tighten
  decdn_cache_evictions_total description from "LRU/LFU" to "LRU".
  decdn_cache_size_limit_bytes is filed at Tier R because the
  appendix's own M-tier definition (slash-risk + delivery-accountability)
  doesn't fit a static configuration-mirror gauge.
- adr/README.md: pandoc reading-order book build adds
  appendix-blob-cache-eviction.md to the appendix block after
  appendix-peer-table-eviction.md.

Closes #220, #447 part 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@alpergundogdu
alpergundogdu force-pushed the docs/adr-030-blob-cache-eviction-policy branch from 3508d9a to 342f42e Compare May 7, 2026 10:53
@alpergundogdu
alpergundogdu merged commit da360c1 into main May 7, 2026
10 checks passed
@alpergundogdu
alpergundogdu deleted the docs/adr-030-blob-cache-eviction-policy branch May 7, 2026 10:58
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.

ADR gap: no decision record for blob cache eviction ordering and interaction with the slashing window

3 participants