Skip to main content
← CONCEPTS / DISTRIBUTED-SYSTEMS
An end-to-end domain learning journey

Lease-Based Cache Invalidation
& Gutter Failover.

Naive look-aside caches suffer permanent stale-value pins when a slow read-miss overwrites a concurrent DB write invalidation; 64-bit Memcache leases reject stale sets in O(1) time.
Start the journey2 sections· Last modified Dec 1, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

When scaling look-aside caches, pair lease_get/lease_set with a short-TTL Gutter pool for dead shards.

TL;DR30-second simplified summary
▾

Eliminates stale-set races, collapses thundering herds, and absorbs shard failures cleanly.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Look-aside caching
Thundering herd problem
Cache invalidation races
Full walkthrough · 2 stages
01
Stage 1 • Problembeginner

The Stale-Set Race & Thundering Herd.

Why this matters: Demonstrate how concurrent read-miss and DB-write operations pin stale data.

Without generation/lease tokens, Memcache cannot tell whether a set() came from a read before or after a delete().

02
Stage 2 • Resilienceintermediate

Gutter Standby Pool Failover.

Why this matters: Absorb dead-shard misses without rebalancing the primary cache ring.

Rebalancing a dead shard's keys onto healthy primary nodes causes cascading OOMs. Routing misses to a small Gutter pool with 30s TTLs keeps DB load bounded.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

How does a 64-bit lease token prevent stale cache refills?

Recommended Learning Flow