Skip to content

Designing warm-cache degradation

A cache can disappear without making every request fail. The harder question is whether the application has a usable slower path, whether the selected cache actually became unavailable, and whether a new process can start under the same conditions. Resilience Gate gives those questions different answers.

Design decision examined. The cache, readiness, and scoring changes below have implementation/test history attributed to devSatym. This case does not claim unlimited fallback capacity or sole original design.

An established application can resolve through PostgreSQL after a Redis miss or error, while a cold process still checks Redis before its first readiness success
A cache hit ends early; fallback uses PostgreSQL.

GET code reads Redis. A hit returns 302 immediately. Miss or cache exception counts a miss and reads PostgreSQL. A durable mapping returns 302 after an optional cache-fill attempt; database failure returns 503. Cache misses alone do not prove outage.

Source-derived explanation; not a live observation.
Read the diagram step by step
  1. A Redis hit returns the redirect immediately.
  2. A miss or Redis exception counts a cache miss and reads PostgreSQL.
  3. A durable mapping returns a redirect; an optional cache-fill failure can be tolerated.
  4. Database failure is a different boundary; cache misses alone do not prove Redis outage.
Public implementation sources

app/main.py · tests/app/test_cache.py

Keep authoritative storage outside the cache

Section titled “Keep authoritative storage outside the cache”

The application stores URL mappings in PostgreSQL. A redirect first reads Redis. A useful cached value returns 302 directly; a miss or bounded cache error increments the miss counter and proceeds to PostgreSQL. A matching database row supplies the destination, and a best-effort cache write can accelerate later requests. Cache-write failure does not undo that authoritative lookup.

This preserves the invariant: Redis accelerates resolution; it is not the durable source of the mapping. The slower path still depends on PostgreSQL. If that required lookup fails, the route returns 503; an unknown code returns 404. A Redis outage increases database work rather than eliminating dependency risk.

The alternative implied by a mandatory cache would make an optional accelerator a request-path failure boundary. The implemented choice accepts slower resolution and more database pressure instead. The history establishes the choice in code, not a record of every alternative personally considered by its author.

Warm and cold readiness are different states

Section titled “Warm and cold readiness are different states”

/livez reports a live application process without checking dependencies. /ready requires PostgreSQL on every call. It requires a successful Redis ping only until this process first becomes ready, then sets has_been_ready.

Process state Redis unavailable, PostgreSQL available Interpretation
Before first readiness success /ready returns 503 Startup has not satisfied the chosen dependency contract
After first readiness success /ready can return ready The warm process may serve through database fallback
Replacement or restarted process Cold rules apply again The readiness flag is process-local, not shared release state
Any state with required PostgreSQL unavailable /ready returns 503 Durable/uncached paths do not have their essential dependency

The startup probe also uses /ready. A cache fault can therefore be tolerated by an established process while preventing a replacement from satisfying startup. Describing Redis as entirely optional at every lifecycle stage would hide this trade-off.

The miss counter includes ordinary uncached reads and Redis errors. A newly created URL does not automatically populate the cache, so healthy traffic can produce first-read misses. A counter increase establishes that the fallback path was used; it does not identify the reason.

The Redis dependency gauge is also insufficient as a continuous health signal: after first readiness success, /ready stops pinging Redis and can retain its previous gauge value. The Redis scorer therefore combines useful non-probe traffic, fallback increments, redirect latency, restart observations, selected-pod readiness during the fault, and final target recovery.

The measured latency is a maximum of sampled one-minute histogram p95 values for the redirect handler, compared with the selected < 1.2s limit. It is neither the worst individual request nor an end-to-end payment guarantee. The restart expression uses a zero default; that symptom check alone cannot prove raw-series presence.

Commit 34b303f2 implements bounded cache lookup, database fallback, and tests. Commit a489a6c6 adds startup/steady-state readiness and the state-transition tests. Commit 02ff9d75 adds Redis behavior scoring.

The current cache tests, health tests, and Redis scoring tests make the deterministic request and measurement contracts inspectable. This article does not report a new execution of those platform tests.

Keep the historical card with its own candidate

Section titled “Keep the historical card with its own candidate”

The 1 October staging record has a passing Redis scorecard. Its window is 17:49:27Z–17:51:47Z, with injection at 17:49:47Z. Its release revision is f156b076ce090594529ffe735b9da561e6e9a2f8 and its run is chaos-gate-fkh9p; the revision and image digest match the sibling run metadata.

This is a structured historical card for that candidate and run. It is not a verdict assigned from screenshot pixels, the later October 2 recovered-directory label, or the October 3 release campaign. A passing Redis card still needs the enclosing gate, cleanup, and analysis outcome before it supports promotion.

The next question is how much extra PostgreSQL load the fallback can absorb during a longer outage or a wave of cold replicas. No such capacity measurement is supplied by this case. The Redis workflow follows the seven-check argument; health and recovery explains startup budgets and process state.

REVIEWED EVIDENCE / CAPTURE 19

What supports the Redis fallback story?

The historical recovery campaign pairs Redis outage evidence with fallback activity and a bounded redirect-latency check. This is one tested window, not an availability promise.

Observed window: 2026-10-02 05:25:30 UTC–05:28:15 UTC

Redis Ready state alone falls from 1 to 0 and returns to 1; redirect p95 rises during database fallback then recovers while traffic continues and 5xx remains zero

Original available · recorded screenshot · numerical verdict not assessed from pixels

Campaign identity and provenance
Captured
3 Oct 2026, 13:10:50 UTC
Source identity
platform dashboard 7ea5e911aba159966b2a54657c501a8e643ee18f; release source 0a98c08ccab5fa7b05efcecf877c714e5c89f025
AnalysisRun
staging.01m3xgybahhk42nh7jd01xyc4k.e7171a5 — Successful
Image / OCI identity
sha256:a5beda836336de1677e27c3c2ff09a1ab27d9366040cd985c347d700de6f476b
Rendered revision
bc388eaff8ff294e1f59b3c417a18c6b96dd5d39
Original SHA-256
b1d286a93888755b7e1b7d80c4e3dcc92909203376a04824a09bb008d6a9c46d

Open original image

Maintained by Satyam Agnihotri · DevOps & Cloud Engineer