BlogRedis

Redis vs Memcached vs Valkey: which cache fits your workload

Scott Sternloff

By Scott Sternloff, Senior Enterprise Architect

LinkedIn · Updated · 12 min read

Redis vs Memcached vs Valkey: which cache fits your workload
On this page

Choose Memcached when you need a simple, multithreaded, volatile cache for pre-serialized values and are happy for the client to handle sharding. Choose Redis, or its BSD-licensed fork Valkey, when you need data structures, persistence, replication with automatic failover, or server-side sharding. Licensing is the other difference: Memcached is BSD licensed, Redis 8 is offered under RSALv2, SSPLv1 or AGPLv3, and Valkey is BSD.

Both are in-memory key-value caches that answer simple GET and SET requests quickly. The differences between Redis and Memcached are in everything around that. On AWS the node price is the same for Memcached and Redis OSS on the same node size, and Valkey is 20% cheaper, so price only decides it if you pick Valkey. Versions, licenses and prices on this page were read on 9 November 2026.

Redis vs Memcached vs Valkey at a glance

Memcached is the simpler engine, a multithreaded volatile cache, while Redis and Valkey add data structures, persistence and replication, and Valkey offers that feature set under a BSD license.

Memcached, Redis and Valkey compared, read 9 November 2026
MemcachedRedisValkey
Latest stable release (read 9 Nov 2026)1.6.45, 9 July 2026Redis Open Source 8.10.3, 26 October 20269.1.3, 26 October 2026
LicenseBSD-3-ClauseBSD to 7.2; RSALv2 or SSPLv1 for 7.4; RSALv2, SSPLv1 or AGPLv3 from 8.0BSD-3-Clause
Data modelKey plus an opaque value; the server does not understand data structuresStrings, hashes, lists, sets, sorted sets, streams, vector sets and moreThe Redis data types; compatible with Redis OSS 7.2 and earlier
PersistenceNone to disk; warm restart (1.5.18 and later) survives clean restarts; extstore can move values to flashRDB snapshots, an append-only file, or bothRDB, AOF, both, or none
Replication and failoverNone; servers do not talk to each otherAsynchronous replicas, Sentinel, Redis ClusterReplication and Valkey Cluster
ShardingClient-side hashing across independent serversClient-side, or server-side with Redis Cluster's 16,384 hash slotsClient-side, or server-side with Valkey Cluster's 16,384 hash slots
ThreadingMultithreaded, 4 worker threads by defaultCommands on one main thread; optional I/O threadsCommands on one main thread; I/O threading reworked in 8.0
EvictionLRU within each slab class, plus expiryTen maxmemory-policy options, including LRM from 8.6, plus expiryEight maxmemory-policy options (LRU, LFU, random, TTL, noeviction), plus expiry
Managed optionsAmazon ElastiCache for Memcached; Google Cloud Memorystore for MemcachedAmazon ElastiCache for Redis OSSAmazon ElastiCache for Valkey; Google Cloud Memorystore for Valkey

How we compared. Release numbers and dates come from the projects' own release listings (memcached.org for Memcached, the GitHub releases of Redis and Valkey). Licenses come from Redis's license page and each project's license file. Behavior comes from each project's documentation, listed under Sources. Prices come from the AWS price list file and Google's pricing page, and the yearly figures are our arithmetic. We cite no vendor benchmarks.

What Redis, Memcached and Valkey cost on AWS

On AWS a cache.r7g.large node costs $0.219 an hour with the Memcached or Redis OSS engine and $0.1752 with Valkey, which is about $1,918 and $1,535 a year for one node. Memcached is not cheaper than Redis OSS at node level, and serverless storage is priced the same for both, so the saving comes from choosing Valkey.

Managed cache list prices, read 9 November 2026
EngineElastiCache node (cache.r7g.large, 13.07 GiB, US East, on-demand)Per year (our arithmetic)Serverless option (US East)
Memcached$0.219 per node-hour$1,918$0.125 per GB-hour stored, plus $0.0034 per million ElastiCache Processing Units
Redis OSS$0.219 per node-hour$1,918$0.125 per GB-hour stored, plus $0.0034 per million ElastiCache Processing Units
Valkey$0.1752 per node-hour$1,535$0.084 per GB-hour stored, plus $0.0023 per million ElastiCache Processing Units
Google Cloud Memorystore for Valkey, highmem-medium (13 GB), Iowa$0.1923 per node-hour$1,685None

Yearly figures multiply the hourly price by 8,760 hours. Every row is a single node with no replica, and prices exclude replicas, backups, data transfer and tax and vary by region. The Google row is a different node size and region, so compare it for scale rather than line by line. Google also sells Memorystore for Memcached, priced per vCPU and per GB of memory, which we do not list because its pricing page was not readable on the day we checked. The AWS figures come from the ElastiCache pricing page and its price list file (published 28 October 2026); the Google figure from Memorystore for Valkey pricing. For Redis Cloud, Azure and the other providers, see managed Redis options compared.

Data structures: the biggest practical difference

A Memcached item is a key, an expiry time, optional flags and raw bytes. The server stores whatever the client serialized and offers little beyond get, set, delete and simple increments. To change one field of a cached object, the client reads the whole value, deserializes it, edits it and writes it back, using check-and-set (CAS) if other writers might race it. Keys are limited to 250 characters, and an item to 1 MB by default, against 512 MB for a Redis string.

Redis does that work on the server. You can increment one field of a hash, add a score to a sorted set or push onto a list in a single atomic command. That is why Redis gets used well beyond caching, for sessions, rate limits, leaderboards, queues and pub/sub messaging; our guide to what Redis is used for covers each. If your application only stores rendered fragments or serialized query results, Memcached's simpler model costs you nothing.

Persistence and restarts

Memcached treats forgetting as a feature. A restart used to mean an empty cache; since version 1.5.18, warm restart can recover the cache across clean restarts such as binary upgrades, with caveats: changing the memory limit, maximum item size or slab sizes starts it clean, and the system clock must not jump while it is down. A crash still means a cold cache. Extstore extends a node's capacity by keeping keys in RAM and values on flash, but it is a capacity feature, not durability.

Redis offers data persistence through RDB snapshots, an append-only file or both, and reloads the data on restart. It can also run with persistence off when it is used purely as a cache. The trade-offs, including how much each option can lose, are covered in our section on Redis persistence.

The practical test is what happens to your database when the cache empties. A cold cache sends every miss to the source of truth at once. If the database cannot absorb that, you need either a cache that survives restarts or a plan to warm it.

Replication, high availability and scaling out

Memcached servers are unaware of each other. There is no crosstalk, synchronization or replication; the client picks a server for each key by hashing. Adding servers adds memory. Losing a server loses its share of the cache, and those keys miss until the application refills them. The Memcached documentation argues that replication would halve the usable cache and that an application should tolerate a few percent of extra misses.

Redis has high availability built in. Sentinel promotes a replica automatically when a primary fails, and Redis Cluster adds server-side sharding across several primaries. Replication is asynchronous, so a failover can drop the last writes, but the dataset survives the loss of a node. Choose Redis if a node failure must not empty part of the cache.

Threading and performance

Memcached is multithreaded and starts four worker threads by default. Redis executes commands on one main thread; since Redis 8, optional I/O threads (io-threads) take over socket reads, request parsing and reply writes, and Valkey 8.0 reworked its I/O threading the same way. For command execution across many cores, Redis's documentation recommends more instances or sharding.

Redis's benchmarking guide says the two compare fairly on GET and SET only when Redis runs single-threaded, and warns against mixing numbers from different tools. We cite no benchmark figures. Network, client library and value size usually matter more than the server, so test your own payloads.

Memory efficiency

Memcached manages memory with a slab allocator. Memory is split into 1 MB pages, each page is assigned to a slab class with a fixed chunk size, and every class keeps its own LRU. An item is stored in the smallest chunk that fits it, so some bytes are wasted per item, and a workload whose item sizes drift over time can leave memory sitting in classes that no longer need it while other classes evict.

Redis allocates per key through its memory allocator. Fragmentation, replication buffers and the copy-on-write cost of the snapshot fork can push resident memory well above the dataset size; our Redis memory guide explains how to size for it. Memcached's own performance page shows a 32-byte base item structure, 40 bytes with a CAS value, before key and value. Redis's memory documentation says small hashes, lists, integer sets and sorted sets use compact encodings that need up to ten times less memory, and recommends hashes over many separate keys for small objects. Neither is universally more compact. Load a representative sample of your data into each and measure.

When to choose which

Memcached fits when:

  • you cache serialized objects, query results or page fragments under 1 MB
  • losing part of the cache on a node failure is acceptable
  • you want to scale a few large nodes vertically across many cores
  • you want the smallest operational surface

Redis or Valkey fits when:

  • you need data structures and atomic server-side operations
  • the cache must survive restarts, or node failures must not lose data
  • the same store also handles sessions, rate limiting, queues or leaderboards
  • you want server-side sharding with automatic failover

If the Redis license is the concern, Valkey keeps the Redis feature set under BSD; our Valkey vs Redis comparison covers the differences, and Redis alternatives covers the wider field.

Moving from Memcached to Redis or Valkey in five steps

A move from Memcached to Redis or Valkey is a client and capacity change, not a data migration, because the cache can refill from the source of truth. The risk is the first hours, when a cold cache sends every miss to your database. These five steps keep that under control.

  1. Pick the engine and the license. Valkey is BSD-3-Clause. Redis Open Source 8 is offered under RSALv2, SSPLv1 or AGPLv3, and AGPLv3 is the OSI-approved option. If those terms are a problem, use Valkey; our Valkey vs Redis comparison covers the rest of the choice.
  2. Swap the client and keep the key names. Memcached and Redis speak different protocols, so you change the client library, not just its address. Valkey's migration guide says existing Redis client libraries connect to Valkey without code changes. Keep the same key names and serialized values so hit rates stay comparable, replace multi-get with MGET, and replace check-and-set (CAS) with WATCH, which Redis documents as its check-and-set mechanism, or with SET and its IFEQ option on Redis 8.4 and later.
  3. Set maxmemory and an eviction policy. On 64-bit systems Redis's maxmemory defaults to zero, which means no limit, so set it. allkeys-lru is the closest match to Memcached's LRU behavior, and Redis's documentation calls it a good default. Leave some RAM free, because replication and persistence buffers are not counted against maxmemory. The Redis eviction policy guide covers the other policies, and a pure cache can run with persistence off.
  4. Size memory per key, not per gigabyte. Do not carry the Memcached figure across one for one. Load a representative sample of production keys into a test instance and read used_memory from INFO memory, then add headroom for the snapshot fork and replication buffers; the Redis memory guide shows how.
  5. Cut over with a cold start or dual reads. For a cache the database can absorb, switch the client and accept a burst of misses. If it cannot, write to both caches, read from the new one and fall back to Memcached on a miss, then remove the fallback once the hit rate settles. Track the Redis hit rate as keyspace_hits / (keyspace_hits + keyspace_misses) against the rate your Memcached stats showed before the move.

When to get help

AceMQ supports both sides of this choice under one database support contract: Memcached support for slab tuning, eviction and capacity, and Redis support and Valkey support for persistence, replication and cluster questions. Cover runs 24/7 across Americas, EMEA and APAC, with response targets from 15 minutes, by plan. If you are weighing a move, our Redis health check reviews an existing estate before you change it, and the Memcached services page describes what we do for caches that stay on Memcached. A move between the two is a cache migration, so the real work is sizing, client configuration and protecting the database while hit rates recover. For Valkey specifically, see our valkey consulting page.

Sources

Frequently Asked Questions

Is Redis faster than Memcached?

Neither is faster in general. For simple GET and SET on small values both answer from memory and perform similarly. Memcached spreads work across worker threads in one process, while Redis executes commands on one main thread with optional I/O threads. Benchmark with your own payloads and client settings.

Does Memcached support persistence?

Not in the way Redis does. Memcached does not write the cache to disk for crash recovery. Since version 1.5.18 its warm restart feature can keep the cache across clean restarts, and extstore can move item values to flash storage, but after a crash the cache starts empty.

Does Memcached support replication?

No. Memcached servers are unaware of each other: no replication or synchronization between them. Clients hash keys across servers, so losing a server loses its share of the cache until those keys are repopulated.

What is the maximum value size in Redis and Memcached?

Memcached limits items to 1 MB by default. A Redis string value can be up to 512 MB, although values that large are rarely a good idea in practice.

Is Memcached open source?

Yes. Memcached is released under a BSD license. Redis 8 is available under RSALv2, SSPLv1 or AGPLv3, and Valkey, the Linux Foundation fork of Redis, is BSD licensed.

Is Valkey an alternative to Memcached?

Yes, when you want Redis features under a BSD license. Valkey keeps the Redis data structures, persistence, replication and cluster mode, so it covers the cases where Memcached is too simple without the Redis 8 license terms.

Can I use Redis and Memcached together?

Yes. Some estates keep Memcached for a large cache of serialized objects and use Redis or Valkey for sessions, counters, queues and other features that need data structures or persistence.

Is Memcached cheaper than Redis on AWS?

No. In the AWS price list for US East, a cache.r7g.large node costs $0.219 an hour with the Memcached engine and with Redis OSS, and ElastiCache Serverless storage costs $0.125 per GB-hour for both. The cheaper engine is Valkey, at $0.1752 an hour for the same node and $0.084 per GB-hour on serverless. Prices read on 9 November 2026.

Can Redis fully replace Memcached?

For most caching jobs, yes: Redis or Valkey stores the same serialized values with expiry and eviction, and adds persistence, replication and data structures. The differences to plan for are that Redis has no CAS token (use WATCH, or SET with IFEQ from Redis 8.4), its memory use per key differs from Memcached's, and a lone main thread executes commands, so very high-concurrency caches may need sharding or more instances.

Is Memcached still relevant in 2026?

Yes. Memcached 1.6.45 was released on 9 July 2026 under a BSD license, and it remains a good fit for a pure, volatile cache of serialized values where losing part of the cache on a node failure is acceptable.

How do I migrate from Memcached to Redis or Valkey?

Choose the engine and license, swap the client library while keeping key names, set maxmemory and an allkeys-lru eviction policy, size memory from a sample of real keys, then cut over with a cold start or with dual reads that fall back to Memcached. No data needs to be copied, because the cache refills from the source of truth.

Scott Sternloff

Author

Scott SternloffSenior Enterprise Architect

Senior Enterprise Architect at AceMQ. Writes the technical coverage here: RabbitMQ, Kafka and Redis architecture, clustering and migrations.

Free Consultation

Get Expert Eyes on Your Redis Deployment

Whether you're troubleshooting a production incident, planning a migration, or want a second opinion on your architecture — our team is ready. No pitch, just answers.

Email Us