Archprimer
TradeoffIntermediate 7 min read

Redis vs Memcached

Redis is a rich data-structure server with persistence and replication; Memcached is a lean, multithreaded string cache. Pick by feature needs vs raw simplicity.

cacheredismemcachedperformance

By Ratish Jain · Updated

Diagram with 4 components: App Server, Redis, Memcached, Disk. Connections: App Server → Redis (rich ops); App Server → Memcached (get/set); Redis → Disk (snapshot).
ServiceCacheStorage
Same app, two cache engines with very different feature depth.

The Decision

Both are in-memory key-value stores sitting in front of a slower database, and both deliver sub-millisecond reads. But they solve different problems. Memcached is deliberately minimal: a multithreaded cache of opaque strings, designed to be dead-simple and to scale reads linearly across CPU cores.

Redis is a data-structure server. It stores lists, hashes, sets, sorted sets, streams and bitmaps, supports persistence, replication, pub/sub and Lua scripting. That power costs some simplicity.

So it depends on whether you need a plain, horizontally-partitioned string cache (Memcached) or a versatile datastore that also happens to be a cache (Redis).

Side by Side

RedisMemcached
Data modelStrings, hashes, lists, sets, sorted sets, streamsStrings/blobs only
ThreadingMostly single-threaded core (I/O threads added later)Fully multithreaded
PersistenceRDB snapshots + AOF logNone; purely volatile
Replication / HABuilt-in replicas, Sentinel, ClusterNone natively; client-side sharding
EvictionMultiple policies incl. LRU/LFU/TTLSlab-based LRU
Extra featuresPub/sub, transactions, scripting, geoMinimal, cache-only
Memory efficiencyHigher overhead per keyVery lean for large flat values

Redis Strengths & Weaknesses

Pros
  • Rich data structures enable leaderboards, queues, rate limiters without extra systems
  • Persistence and replication give durability and high availability
  • Pub/sub, streams and Lua scripting reduce round trips
Cons
  • Single-threaded core can bottleneck on a hot instance
  • More memory overhead and operational surface to tune
  • Feature richness invites misuse as a primary database

Decision Guide

Decision Guide

Choose Redis when you need data structures, persistence, replication, pub/sub, or atomic server-side operations — it is the default for most modern systems. Choose Memcached when you want a pure, simple, multithreaded string cache that scales across cores with minimal ops, and you can tolerate losing the entire cache on restart.

Real-World Examples

Twitter
Historically used Memcached at massive scale for simple timeline/object caching
GitHub
Uses Redis for queues, rate limiting and ephemeral state
Stack Overflow
Runs Redis for caching plus pub/sub across web tiers
Facebook
Built mcrouter to scale Memcached across huge fleets

Interview Questions

Why can Memcached sometimes out-throughput Redis on a single node?

Memcached is fully multithreaded and can saturate many cores for simple get/set, while Redis's command execution is single-threaded, so a very hot flat-string workload can favor Memcached.

If you only need a cache, why do most teams still pick Redis?

Persistence and replication mean a restart or failover does not cold-start every cache, and the data structures often eliminate other infrastructure — the operational value usually outweighs Memcached's raw simplicity.

60-Second Revision
  • →Memcached = simple, multithreaded, volatile string cache.
  • →Redis = data-structure server with persistence, replication, pub/sub.
  • →Redis core is single-threaded; Memcached scales across cores.
  • →Redis survives restarts via RDB/AOF; Memcached loses everything.
  • →Default to Redis unless you specifically want minimal string caching.

Related

Everything on Archprimer is connected — follow the graph.