Handbooks  /  Redis vs Memcached
Engineering~8 min readComparison
Head to Head

Redis vs Memcached: a cache, or a toolbox?

RedisvsMemcached

Both put data in RAM by a key and return it fast, so they look interchangeable. The split is scope: Memcached does one thing — a blazing, simple key-value cache — while Redis is a data-structure server that also caches. If all you need is caching, the simpler tool may win; the moment you need more than get/set, Redis pulls away.

01

The core difference: one job vs many

Memcached is a deliberately minimal, multithreaded key-value cache: strings in, strings out, evicted under memory pressure, no persistence, no bells. That simplicity makes it lean and easy to scale for one job — caching. Redis is a data-structure server: alongside strings it offers lists, sets, sorted sets, hashes, streams, bitmaps and more, plus persistence, replication, pub/sub, transactions, Lua scripting and clustering. It caches too — but it does far more.

→ The rule

Only need a simple, huge, cheap cache for strings/objects? Memcached is lean and fine. Need data structures, persistence, pub/sub, leaderboards, rate limiters, queues, or anything past get/set? Redis — which is why it’s the default for most teams today.

02

Head to head

DimensionRedisMemcached
Data typesStrings, lists, sets, sorted sets, hashes, streams…Strings (opaque blobs) only
ThreadingMostly single-threaded core (very fast)Multithreaded
PersistenceYes (RDB snapshots, AOF log)No — purely in-memory
Replication / HAYes (replicas, Sentinel, Cluster)No built-in replication
Pub/Sub & streamsYesNo
EvictionConfigurable policies (LRU, LFU, TTL…)LRU
Memory efficiencyGood; slight overhead for structuresVery lean for plain key-value
Best fitCache + data store + messagingSimple, large-scale caching
03

When to use each

Reach for Redis

  • Leaderboards (sorted sets), counters, rate limiters
  • Sessions or data you can’t afford to lose (persistence)
  • Pub/sub, streams, lightweight queues
  • Anything richer than string get/set
  • You want one tool for cache + more

Reach for Memcached

  • Pure caching of strings/serialized objects
  • Very large, simple caches where leanness matters
  • Multithreaded throughput on big multi-core boxes
  • You explicitly want minimal features/ops surface
  • Cache loss is harmless (regenerate on miss)
→ The honest default

Most teams pick Redis today — it does everything Memcached does and grows with you, so you rarely regret it. Choose Memcached deliberately when the workload is strictly simple caching and its lean, multithreaded model is a measured win.

04

Why the threading models differ — and why it matters less than people think

Memcached is multithreaded at the core: multiple worker threads share one big hash table behind a lock, so on a 32-core box it can genuinely use many cores for raw get/set throughput. Redis's core command execution is single-threaded — one thread runs your GET, LPUSH or ZADD at a time, which is precisely what makes every Redis command atomic with no locking, no race conditions, no partial writes visible to another client. Redis 6+ added I/O threads to parallelize the cheap work of reading bytes off the socket and parsing the protocol, but command execution itself stays single-threaded.

In practice this rarely matters. A single Redis core can push hundreds of thousands of simple operations per second — memory bandwidth and network I/O become the bottleneck long before the single-threaded execution model does. Memcached's multithreading only shows a real edge at extreme concurrency on very large multi-core machines doing nothing but plain key-value gets — exactly the narrow case where Memcached's minimalism was designed to win. For anything with mixed operation types, larger values, or data structures, Redis's single-threaded simplicity is a feature: no lock contention, no torn writes, and command behavior you can reason about without thinking about interleaving.

→ The trade you're actually making

Multithreading buys Memcached raw throughput ceiling on simple workloads. Single-threading buys Redis atomicity guarantees for free — every command, including multi-step ones like ZADD then ZRANGE, executes without another client's command interleaving mid-way.

05

A worked scenario: building a leaderboard

Say you need a live leaderboard for 2 million players, updated on every game and read constantly for "top 100" and "my rank." With Memcached, there's no native ranked structure — you'd fetch the entire score set into your application, sort it in-memory, and re-cache the sorted result, or maintain your own auxiliary ranking system in a real database and use Memcached only to cache the rendered page. Either way, a single score change means recomputing or invalidating a chunk of that cached structure, and "what's my rank right now" is expensive to answer freshly.

With Redis, a leaderboard is a ZADD leaderboard <score> <player> away from existing as a first-class sorted set. ZRANGE leaderboard 0 99 REV returns the top 100 in O(log N + 100) time. ZRANK leaderboard player123 returns any player's live rank in O(log N). No batch recomputation, no cache invalidation dance — the data structure is the answer, kept correct automatically as scores update. This is the concrete shape of "Redis is a data-structure server": the leaderboard isn't a caching problem bolted onto a database, it's a native operation.

→ The pattern generalizes

Rate limiters (sliding-window counters), unique-visitor tracking (HyperLogLog), job queues (lists with blocking pops), and "who's online" (sets with TTL) all follow the same shape: Memcached would need the feature built in application code on top of a plain cache; Redis has the primitive already.

06

Common mistakes

MistakeWhy it bites
Treating Redis persistence as a database backupRDB/AOF protect against a restart losing the cache, not against needing point-in-time backups, cross-region durability, or transactional guarantees a real primary database provides. Redis persistence is "don't lose it on restart," not "this is now your system of record."
Storing large blobs as single Memcached valuesMemcached has a default 1MB value size limit and no partial-update support — updating one field of a large cached object means re-serializing and re-sending the whole thing. Redis hashes let you update individual fields without touching the rest.
Assuming Redis Cluster gives you what a single Redis instance gives youMulti-key operations (transactions, certain Lua scripts) only work reliably when all keys hash to the same cluster slot. Teams that scale from single-node Redis to Cluster without checking this hit surprising CROSSSLOT errors in production.
Running Memcached expecting durabilityA Memcached restart, deploy, or OOM-kill empties the cache instantly and completely — every request becomes a cache miss at once. If that stampede would hurt (thundering herd on your database), you need warming/staggering logic Redis's persistence would have avoided needing.
Your call

Which would you pick?

Three situations. Pick the side you'd actually build — the explanation follows.

You need caching plus sorted sets, counters and pub/sub in the same system.

A colleague enables Redis persistence and says the cache can now be the system of record.

A pure look-aside cache of small opaque strings, multi-threaded, with no need for data structures.

Frequently asked

Quick answers

What is the main difference between Redis and Memcached?

Memcached is a minimal, multithreaded key-value cache for strings only, with no persistence. Redis is a data-structure server: it offers lists, sets, sorted sets, hashes, streams and more, plus persistence, replication and pub/sub. Both cache; Redis does much more.

Is Redis or Memcached faster?

For plain get/set both are extremely fast and memory-bound; differences are usually negligible. Memcached’s multithreading can edge ahead on huge multi-core boxes for simple key-value at very high concurrency, but Redis’s speed is more than enough for nearly all workloads and it does far more.

Does Memcached support persistence?

No. Memcached is purely in-memory — restart it and the cache is empty. Redis offers persistence (RDB snapshots and the AOF log) plus replication and failover, so it can serve as a durable store, not just a cache.

Which should I use, Redis or Memcached?

Default to Redis unless you have a specific reason not to — it caches like Memcached and adds data structures, persistence and messaging, so it scales with your needs. Choose Memcached when you want a deliberately lean, simple cache for strings and cache loss is harmless.

▶  Watch it explained

Redis vs Memcached: a simple bucket, or a toolbox?

Redis vs Memcached · Engineering · Vibe Engines · 2026
Finished this one? 0 / 208 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Handbooks