Lazy Defenses: Using Scaled TTLs to Keep Your Cache Correct
summary
Describes a concrete system: uses Twitter memcache plus an in‑process hot‑key cache with 30s TTL for spikes, scaled TTLs that start at 2 minutes and ramp to 30m 6h 12h 24h based on consecutive identical reads, and an auto‑darkening/backpressure mode to serve stale values during backend failures. Implementation stores a small counter per cached value; result is up to a 30% reduction in cross‑DC inconsistencies, 99.9% of requests served from cache, and effective handling of millions qps.
AI-written summary · about
chapters (12)
- 0:00Introduction to caching
- 3:05Twitter's caching architecture
- 5:14Basic cache implementation
- 8:28Advanced TTL strategies
- 10:37User service characteristics
- 13:54Solving hot key issues
- 16:45Handling service outages
- 18:31Fixing inconsistent data
- 21:58Implementing scaled TTLs
- 29:11Metrics and gotchas
- 32:54Code idioms and libraries
- 36:35Conclusion and summary








