Caches · Updated 2026-05-24

Redis vs Memcached

Redis is the default for almost every cache workload now: it has data structures, persistence, pub-sub, and clustering in the box. Memcached is the right answer when the workload is a flat key-value cache and the team values the simplest possible operational story.

PLATE — IN-MEMORY LAYOUTREDIShashnameagecitylistzset1.237.5122288streamAOFappend-only persistencevsMEMCACHEDslab 64Bslab 128Bslab 512Bslab 1KLRUtail · head · ↑ evictthreadsT0T1T2… 16DATA STRUCTURES · FLAT SLABS
Redis
In-memory data structure store. Cache, queue, pub-sub, primary store — take your pick.
Since
2009
By
Salvatore Sanfilippo / Redis Ltd. (now under Redis Source Available License v2)
License
RSALv2 / SSPLv1 (since 2024); BSD until then. Valkey is the BSD fork.
redis.io ↗
Memcached
A simple, multi-threaded, in-memory KV cache. That’s it.
Since
2003
By
Brad Fitzpatrick / Danga Interactive
License
BSD 3-clause
memcached.org ↗

These tools live in different categories now. Redis is a wide platform that also caches well. Memcached is a single-purpose cache that does only one thing. Most teams pick Redis for the optionality. The teams who pick Memcached do so because that optionality is, for them, a cost.

Quick takes

If you're…

  • You only need a flat key-to-value cache and have many CPU cores Memcached Memcached is multi-threaded; Redis is mostly single-threaded per instance.
  • You need sorted sets, hashes, streams, or geospatial queries Redis Memcached has no data type beyond a byte blob.
  • You want a cache that survives a restart Redis Redis ships RDB snapshots and AOF; Memcached loses everything on restart by design.
  • You need pub-sub or stream-style messaging Redis Redis Pub/Sub and Streams are built in. Memcached has neither.
  • You are fronting Postgres or MySQL with cached page renders Either Both work well. Familiarity and ops cost decide it.
  • You are building rate limiters or session stores Redis INCR with EXPIRE is trivial in Redis; Memcached’s atomic operations are weaker.
  • You need strict TTL eviction and predictable memory shape Memcached Memcached’s slab allocator and LRU is the simplest predictable behaviour to deploy.
  • Values are small (under 1MB) and access is random Either Both saturate the network at this size. Latency difference is sub-millisecond.
Decision wizard

A few questions, a verdict.

Q1

Do you need anything beyond plain key→value?

Q2

Does your cache need to survive restarts?

Q3

Cluster expectations?

Q4

Read/write threading?

At a glance

The scorecard.

Dimension
Redis
Memcached
Edge
Lists, hashes, sets, streams, geo
Byte blob only
Redis
RDB and AOF, tunable
None by design
Redis
Single-threaded (mostly)
Multi-threaded, scales with cores
Memcached
Built-in cluster + Sentinel
Client-side sharding only
Redis
Pub/Sub and Streams
None
Redis
Variable; multiple encodings
Slab allocator, tunable
tie
RSALv2 / SSPLv1; use Valkey for OSS
BSD, clean
Memcached
Many, including Valkey
Available on major clouds
Redis
In depth

Dimension by dimension.

core

Data types

edge: Redis
Redis

Strings, lists, hashes, sets, sorted sets, bitmaps, HyperLogLogs, geospatial entries, streams. Each has dedicated commands (LPUSH, ZADD, HSET, GEOADD, XADD). The data-structure surface is the reason most teams choose Redis.

Memcached

Byte blob. Clients can JSON-encode whatever they want, but atomic operations on individual fields are not available. INCR exists. That is the extent of structure.

core

Persistence

edge: Redis
Redis

RDB snapshots for point-in-time backups and AOF for an append-only log of every command, with tunable fsync. Configurable for "never lose more than 1s of writes." Persistence is optional; pure-cache mode is supported.

Memcached

None. Restarts lose everything. This is intentional. It keeps the design simple and avoids the corruption-recovery story.

core

Threading model

edge: Memcached
Redis

Single-threaded event loop for command execution. Redis 6+ added multi-threaded I/O but command dispatch is still serial. Predictable, no locking, but per-instance throughput is bounded by one core.

Memcached

Multi-threaded. Scales close to linearly across cores up to about 16 threads. On a 32-core machine, Memcached out-throughputs a single Redis instance on simple GET/SET by 2-3x.

ops

Clustering

edge: Redis
Redis

Redis Cluster is built in. Hash-slot sharding (16384 slots), automatic failover via Sentinel or Cluster mode, automatic resharding. Client libraries handle MOVED redirects.

Memcached

No native clustering. Sharding is client-side, usually consistent hashing in the client library (ketama). Simple, but rebalancing is the operator’s problem.

features

Pub/Sub and messaging

edge: Redis
Redis

Native Pub/Sub and Redis Streams, the latter with consumer groups, persistence, and message acks. Streams covers many event-driven needs without reaching for a full broker.

Memcached

None.

ops

Memory efficiency

tie
Redis

Variable overhead per key, roughly 50-100 bytes for short keys. Multiple encoding schemes (ziplist, intset, listpack) compact small structures. MEMORY DOCTOR helps debug overhead.

Memcached

Slab allocator with fixed page sizes. Lower per-key overhead, but memory can be wasted if value sizes do not fit slab boundaries. Tunable via -f and -n flags.

ecosystem

License (post-2024)

edge: Memcached
Redis

Redis Ltd. moved Redis to RSALv2 and SSPLv1 in 2024. Cloud vendors can no longer offer it as a service without a commercial agreement. AWS, GCP, and Oracle forked the BSD-era code to create Valkey, now under the Linux Foundation.

Memcached

BSD 3-clause. Stable for two decades. No license-change events to worry about.

ecosystem

Hosted offerings

edge: Redis
Redis

AWS ElastiCache (Redis and Valkey), GCP Memorystore, Azure Cache, Upstash, Redis Cloud, Aiven. Since the 2024 license change, most clouds default to Valkey but accept Redis if the customer pays.

Memcached

AWS ElastiCache (Memcached engine), GCP Memorystore (Memcached). Quieter, but very stable.

Benchmark

GET-heavy workload, 100-byte keys, 1KB values

memtier_benchmark, 32 client threads, 50/50 GET/SET, 10M keys, c5.4xlarge (16 vCPU). Single-instance Redis runs on one core; Memcached spreads across all 16; the cluster row shows Redis sharded across 6 nodes for matched parallelism. Numbers reproduced from the official memtier_benchmark README plus AWS's public Redis-vs-Memcached ElastiCache study.

Metric
Redis
Memcached
Better
Throughput (1 instance)
Memcached uses all 16 cores; Redis uses one.
95k ops/s
240k ops/s
Memcached
Throughput (Redis Cluster, 6 nodes)
Cluster equalises; total cores roughly matched.
540k ops/s
240k ops/s
Redis
p99 latency
0.8 ms
0.4 ms
Memcached
Memory overhead per key
96 bytes
56 bytes
Memcached

Source: memtier_benchmark (Redis Labs / Open Source) ↗

When to pick neither

A different shape of problem.

  • Valkey
    Drop-in Redis fork with a BSD license, under the Linux Foundation
  • KeyDB
    Multi-threaded Redis fork; Redis features with Memcached-style threading
  • Dragonfly
    Newer shared-nothing server, Redis protocol compatible, very high throughput
  • Hazelcast
    JVM-native distributed cache and computation grid
  • Aerospike
    NVMe-backed cache and persistent store hybrid at large scale
  • Couchbase
    Key-value plus N1QL queries and global replication
Situational picks

For specific cases.

Fronting a database with cached query results (pages, API responses)

Either

Both work. The team that already operates one of them should keep doing so. Memcached is cheaper at the instance level; Redis preserves optionality.

Session store with TTL and atomic counters

Redis

INCR with EXPIRE on a single key, atomic. Hashes for session payloads. Persistence so a restart does not log everyone out.

Leaderboards, rate limiters, and real-time counts

Redis

ZADD and ZINCRBY on sorted sets match the shape of these problems exactly. Memcached has no path here.

Pure object cache fronting a CMS in a single hot region

Memcached

Multi-threaded throughput, lower per-key memory overhead, BSD license. Pair with client-side consistent hashing.

Event streaming with consumer groups at sustained volume

Kafka or Redpanda

Redis Streams works at small scale. At high volume, many consumers, or long retention, a real broker is the right tool.

Sources

Primary material.

Found this useful?