HeadlinesBriefing favicon HeadlinesBriefing.com

Memcached vs Redis: Why Simpler Caching Wins

Hacker News •
×

System administrators often default to Redis when they need a cache, but the author argues this choice creates operational headaches. Redis gets treated as a persistent database despite being deployed as volatile cache, leading to painful discovery when upgrades or failures expose this mismatch. The persistence features that make Redis powerful also make it dangerous in caching roles.

Memcached takes a different approach - it has no persistence layer, which eliminates the temptation to treat it as permanent storage. When a node goes down, client libraries gracefully handle connection failures by returning default values instead of crashing. This design philosophy extends to clustering, where clients simply hash keys across multiple server URLs without complex orchestration.

The operational simplicity pays dividends. Memcached instances run with minimal overhead, often using just 64MB of cache space. Since there's no state to preserve, these workloads behave like truly stateless services that can be scheduled and moved freely. The author acknowledges Redis can accomplish similar results, but requires significantly more configuration and monitoring.

Many performance problems labeled as 'database too slow' actually stem from poorly written queries or missing indexes. Teams should profile their queries before adding caching layers, and when cache is genuinely needed, Memcached provides a straightforward solution that's hard to misuse.