Repair Cache Stampede Failures

    by Mariusz Wrzeszczynski

    1

    Stop cache stampedes by repairing fill ownership, request coalescing, lock safety, refresh failures, TTL synchronization, and cold-cache overload.

    Secure checkout via Stripe

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    See it in action

    You say

    Our Node/TypeScript product catalog uses Redis in front of PostgreSQL. A top-selling product key has a 5-minute TTL. When it expires, 200–500 concurrent requests all miss Redis and call the same expensive SQL query. We already have a Redis lock, but its lease is 2 seconds while the query sometimes takes 4–6 seconds, so another request can acquire the lock before the first fill completes. Waiting requests poll every 50 ms, and on refresh failure every caller bypasses cache. Repair the repository so one hot-key expiry does not create a thundering herd. Use local Redis/test fixtures and deterministic concurrency tests. Do not flush production Redis, change live infrastructure, or invent a new freshness SLA.

    Your agent does

    Cache stampede found. A hot-key expiry triggers parallel SQL fills because the lock lease is shorter than the fill, followers poll aggressively, and refresh failure bypasses the cache per caller. The repair adds per-key coalescing, safer distributed ownership, generation protection, bounded follower behavior, concurrency tests, and fill metrics. Production capacity and freshness policy remain unverified.

    What you get

    Implement request coalescing to collapse multiple misses into one origin call.Add TTL jitter to prevent synchronized expiration of large datasets.Configure stale-while-revalidate to serve data while background refreshes run.Establish lock lease contracts to prevent deadlocks during long cache fills.

    About this skill

    Cache stampedes happen when a cache miss becomes a concurrency problem: hundreds of callers expire the same key, race for a lock, retry independently, or all fall back to the origin after one refresh failure.

    Repair Cache Stampede Failures gives an AI coding agent a repository workflow for tracing cache-fill ownership across application caches, Redis, loaders, background refresh jobs, distributed locks, retries, stale paths, and negative caching. It repairs single-flight/coalescing behavior, lock ownership, stale-owner protection, failure containment, TTL jitter, deterministic burst tests, and fill observability.

    It does not flush production caches, change live CDN/provider settings, invent staleness or capacity limits, or claim production safety from local tests.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Frequently Asked Questions

    Popular in AI Agents & LLM Ops