Skip to the content.

Predictive cache pre-warming (Task 134)

The predictive pre-warming subsystem (internal/prewarm) forecasts likely near-future pulls from historical pull telemetry and proactively fetches + admission-gates them during off-peak windows, so cache hits and gate verdicts are ready before the first client request.

It is optional and disabled by default. It is distinct from the air-gapped mirror pullthrough prewarm command (Task 17), which is an on-demand, manifest-driven cache fill that does not run the admission gates.

What it predicts

The learned history is a bounded, in-process record of the coordinates clients actually pull, fed by a tap on the gateway serve path (the subsystem’s own synthetic fetches are excluded, so it never bootstraps predictions off its own activity). From it the built-in heuristic predictor forecasts:

Safety properties

Configuration

See the prewarm: stanza in configs/config.example.yaml and the generated docs/configuration-reference.md. The minimal enablement:

prewarm:
  enabled: true
  offPeakStart: "01:00"
  offPeakEnd: "05:00"
  offPeakTimezone: UTC

Observability

Prometheus counters (all pullthrough_prewarm_*):

Metric Meaning
pullthrough_prewarm_predicted_total artifacts the predictor forecast
pullthrough_prewarm_fetched_total fetched + admitted into the cache ahead of demand
pullthrough_prewarm_already_cached_total predicted artifacts already cached
pullthrough_prewarm_gate_blocked_total pre-warmed artifacts an admission gate refused
pullthrough_prewarm_errors_total pre-warm fetches that failed (e.g. a nonexistent predicted version)
pullthrough_prewarm_hit_attributed_total client cache hits served from a prior pre-warm
pullthrough_prewarm_cycles_total cycles executed
pullthrough_prewarm_cycles_skipped_total{reason} cycles skipped (not-leader / kill-switch / off-peak / no-fetcher)

CLI and admin API