Caching Best Practices
summary
Focuses on in-memory key value caches like memcache and routing layers like mcrouter or twemproxy and shows concrete failure modes: keys expire, are evicted when memory fills, or get corrupted by version changes. Recommends using only set/get/get_many/delete, configuring socket and TCP options, preferring multi-get, measuring per-code-path hit/miss ratios, exposing a dummy-cache toggle, and testing hit path, stale-value detection, disconnects and rolling upgrades. Advises expiry strategy and continuous monitoring to avoid caches becoming an overhead.
AI-written summary · about
chapters (15)
- 0:00Introduction and speaker intro
- 1:27What is a cache and why use it
- 3:12Cache for latency vs resources
- 7:00Memcache overview and basics
- 10:09Cache eviction and memory limits
- 11:56Cache routing with mcrouter
- 15:26Why routing is not optional
- 17:35Caching complicates application code
- 20:25Handling cache failures and edge cases
- 22:12Cache invalidation challenges
- 23:59Testing cache behavior under pressure
- 26:07Measuring cache effectiveness
- 28:54Debugging and A/B testing with dummy cache
- 30:21Cache granularity and serialization
- 32:50Best practices and key takeaways
