The idea to keep with you
When a cache shard dies or races with DB writes, leases reject stale sets and Gutter absorbs misses.
TL;DR30-second simplified summary▾
Cuts stale pins to zero and prevents 100k QPS DB spikes on shard loss.
Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Look-aside caching
Memcache lease protocol
Gutter failover
Full walkthrough · 2 stages
01
Stage 1 • Diagnosisintermediate
Pinpointing the Stale-Set & Herd Race.
Why this matters: Trace the exact interleaving that pins stale values for 3,600s.
Reader A loads v1, stalls on GC, Writer B commits v2 and deletes cache, Reader A resumes and calls cache.set(v1).
02
Stage 2 • Solutionintermediate
Lease-Guarded Refill & Gutter Routing.
Why this matters: Implement lease_get/lease_set with Gutter fallback in Java.
Mcrouter/client checks shard health; if unreachable, it routes to Gutter with a 30s TTL so stale data cannot linger after the primary shard recovers.
Practice · Explain the consequences
Practice: Make the trade-off yourself.
Question 1 of 3
Score: 0/3Why must Gutter entries use a short TTL (e.g., 30s) instead of 3,600s?
Recommended Learning Flow