Valkey vs Redis in 2026: Which to Choose and How to Migrate Safely
Valkey vs Redis at the end of 2026: licences, feature gaps and client compatibility, plus tested migration paths from Redis 7.2 and from Redis 7.4 or 8, whose data files Valkey won't load.

The question usually arrives sideways. A licence review flags the Redis server in your stack, or someone notices that the managed cache line on the AWS bill would be lower on a different engine, or a new hire asks why the Docker Compose file still says redis:7.2. Then the real question follows: should we move to Valkey, and if we do, how do we move the data without losing sessions, queued jobs or rate-limit counters?
This guide answers both parts for Valkey vs Redis as things stand at the end of November 2026, with Valkey 9.2.1 (released 26 November) and Redis Open Source 8.12.0 (released 22 November). The comparison part is short, because for most application code the two still behave the same. The migration part is longer, because that is where teams get caught: Redis 7.4 and later write data files that Valkey will not load by default, and we tested exactly what that means in practice.
The short answer
- Pick Valkey if you want a BSD-licensed server under the Linux Foundation, you run on a managed service that prices Valkey lower, and you use Redis as a cache, session store, queue broker, rate limiter or pub/sub bus.
- Stay on Redis if you depend on features that only Redis 8 ships in its core build, such as vector sets, set member expiration or the Redis query engine, or if you already pay for Redis Cloud or Redis Software and its support.
- Plan the data move carefully if you are on Redis 7.4 or newer. The easy migration paths that work from Redis 7.2 (copying the RDB file, or attaching Valkey as a replica) fail against Redis 8 in their default settings.
What actually differs in 2026
Licence and governance
Valkey started in March 2024 as a fork of Redis OSS 7.2.4, after Redis moved away from the BSD licence. It is BSD 3-Clause and run under the Linux Foundation. Redis has since added a third option: according to the Redis licensing page, Redis Open Source 8 and later can be used under RSALv2, SSPLv1 or AGPLv3. AGPLv3 is an OSI-approved open source licence, but it is copyleft, so legal teams that were comfortable with BSD may still want to review it, especially if you modify the server or offer it to others as a service. Redis 7.2.x and earlier remain BSD.
If your company has no policy concerns about AGPL and you don't modify or redistribute the server, licensing alone may not be a reason to move. It is a reason to make the decision on purpose rather than by default.
Features: mostly shared, with growing edges
We built both servers from source and compared the command lists they report. The Redis 8.12 core build (without the optional modules) lists 468 commands, Valkey 9.2.1 lists 425, and 393 are shared. Everything most web applications use is in the shared set: strings, hashes, lists, sets, sorted sets, streams and consumer groups, pub/sub, Lua scripting, transactions, and hash field expiration (HEXPIRE and friends, added to Valkey in 9.0).
The differences are newer features:
- Only in Redis 8.12 core: vector sets (
VADD,VSIMand related commands), set member expiration (SEXPIRE,STTL),BLESSto protect keys from eviction, and atomic sorted-set moves (ZMOVE). The full Redis Open Source build also bundles the query engine, JSON, time series and probabilistic data types. - Only in Valkey 9.2: the Path Hash data type (
PH*commands for longest-prefix lookups),COMMANDLOG,CLUSTERSCAN, and, per the 9.2.0 release notes, opt-in forkless snapshots, ACL roles and built-in hot key detection. JSON, Bloom filters, search and LDAP authentication come as separate modules, packaged together in Valkey Bundle. - Both, recently: conditional delete with
DELEX ... IFEQ, which makes the classic "delete the lock only if I still own it" pattern a single command instead of a Lua script. It arrived in Redis 8.4 and Valkey 9.2. Redis 7.2 doesn't have it.
Over time these edges matter more than the licence. If a feature you rely on exists on only one side, code written for it won't run on the other, and data stored with it can't be moved by the simple methods.
Client compatibility
Valkey speaks the same RESP protocol, so existing Redis clients connect without changes. We ran one script through redis-py 6.1 against Redis 7.2.17, Redis 8.12.0 and Valkey 9.2.1: SET with expiry, hashes, a pipeline, a Lua EVAL, sorted sets, a stream consumer group and pub/sub returned identical results on all three. We didn't test other client libraries, so check yours, but the protocol layer is not usually where migrations break.
One detail does break things: Valkey reports redis_version:7.2.4 in INFO for backward compatibility, even on 9.2.1. Code that checks the version before using a newer command will decide that Valkey 9.2 can't run HEXPIRE, even though it can. Detect the server like this instead:
def server_identity(r):
"""Return ("valkey", "9.2.1") or ("redis", "8.12.0") for a redis-py client."""
info = r.info("server")
if info.get("server_name") == "valkey":
return "valkey", info["valkey_version"]
return "redis", info["redis_version"]
Better still, test for the command you need with COMMAND INFO rather than comparing version numbers.
Managed services and cost
On AWS, the ElastiCache pricing page lists Valkey at 33% lower than other engines on Serverless and 20% lower on node-based clusters, with a 100 MB minimum on Serverless instead of 1 GB. Check your provider's current price list before using that in a business case, and remember that the saving only matters if the cache is a meaningful line on your bill. We haven't benchmarked Valkey against Redis for performance in this article; any speed difference depends on your workload, and published benchmarks rarely match a real application.
The migration trap: data files stopped being compatible
The Valkey migration guide is clear: Valkey reads RDB and AOF files from Redis OSS 7.2 and earlier, and "RDB files produced by Redis CE 7.4 and later are not compatible". That matters because the two most convenient migration methods both move RDB data:
- Physical migration copies
dump.rdbto the new server and starts it. - Replication attaches Valkey as a replica with
REPLICAOF. The first full sync ships an RDB snapshot over the network.
The first nine bytes of the file show the problem. A Redis 8.12 dump starts with REDIS0017, so RDB format version 17. When we started Valkey 9.2.1 on that file, it exited with Can't handle RDB format version 17. A DUMP payload from Redis 8.12 was rejected by RESTORE with "DUMP payload version or checksum are wrong", and a Valkey replica pointed at Redis 8.12 downloaded the snapshot, logged Failed to load RDB and kept retrying with the link down.
The relaxed escape hatch, and where it stops
Valkey has a setting, rdb-version-check, which defaults to strict. Set to relaxed, it tries to load newer RDB versions "on a best-effort basis" and aborts if it meets data it doesn't understand. The setting also applies to replication and RESTORE. We tested it data type by data type on Redis 8.12 output:
- Strings with and without TTLs, lists, sets, small and large sorted sets, and hashes without field TTLs all loaded.
- A single hash with one field TTL stopped the load:
Can't handle foreign type or opcode 25. Valkey supports field TTLs, but not Redis's on-disk encoding of them. - A stream with a consumer group stopped it with opcode 27.
- A relaxed Valkey replica synced 1,002 plain keys from Redis 8.12 and then applied a live
HEXPIREcorrectly, because live changes travel as commands. With a stream in the source, the initial sync failed.
So relaxed mode can work if your data really is limited to the basic types, but one stream or one expiring hash field from a library you forgot about will stop it, and a later full resync can fail on data that was written after the cutover started. Treat it as something to rehearse on a copy of production data, not as the plan.

Choose the migration path by source version

From Redis 7.2 or older: replicate, then promote
This is the path the Valkey guide recommends for minimal downtime, and it worked as documented in our test against Redis 7.2.17. On the new Valkey server:
valkey-cli -h valkey-host REPLICAOF redis-host 6379
valkey-cli -h valkey-host INFO replication # wait for master_link_status:up
valkey-cli -h valkey-host DBSIZE # compare with the source
# stop writes on the old server, let the replica catch up, then:
valkey-cli -h valkey-host REPLICAOF NO ONE
The replica received all 1,002 keys with their TTLs, applied a write made after the sync, rejected writes with READONLY while it was a replica, and accepted them after REPLICAOF NO ONE. Add primaryauth or primaryuser if the source requires a password. Allow a few seconds before checking: the source waits for repl-diskless-sync-delay (five seconds by default) before it starts the transfer, and our first check came too early.
If a short maintenance window is fine, physical migration is simpler: stop writes, run SAVE on Redis, copy dump.rdb to the Valkey data directory, and start Valkey. If AOF is enabled on the Valkey side, follow the extra steps in the migration guide so the copied file is actually loaded.
From Redis 7.4 or 8.x: copy keys through the protocol
When RDB bytes can't move, move the data through commands the target understands. The script below walks the keyspace with SCAN, reads each key with type-specific commands and writes it to Valkey in a transaction, keeping key TTLs and hash field TTLs. Streams are copied entry by entry with their original IDs, and consumer groups are recreated at their last-delivered position. Types it doesn't know, such as vector sets, JSON or time series, are counted and skipped rather than guessed at.
"""Copy keys from Redis 7.4+/8.x to Valkey through the client protocol.
Use it when RDB files and replication can't be used (Redis 7.4 and later).
Run it while writes to the source are stopped: it copies a snapshot, not a live stream.
"""
import argparse, collections
import redis
def copy_key(src, dst, key, ktype):
pttl = src.pttl(key)
if pttl == -2: # expired or deleted since SCAN returned it
return "gone"
p = dst.pipeline(transaction=True)
p.delete(key)
if ktype == "string":
p.set(key, src.get(key))
elif ktype == "list":
p.rpush(key, *src.lrange(key, 0, -1))
elif ktype == "set":
p.sadd(key, *src.smembers(key))
elif ktype == "zset":
p.zadd(key, dict(src.zrange(key, 0, -1, withscores=True)))
elif ktype == "hash":
fields = src.hgetall(key)
p.hset(key, mapping=fields)
names = list(fields)
for name, at_ms in zip(names, src.hpexpiretime(key, *names)):
if at_ms > 0: # field-level TTL (Redis 7.4+, Valkey 9.0+)
p.hpexpireat(key, at_ms, name)
elif ktype == "stream":
for entry_id, fields in src.xrange(key, "-", "+"):
p.xadd(key, fields, id=entry_id)
for g in src.xinfo_groups(key): # groups and their position, not pending entries
p.xgroup_create(key, g["name"], id=g["last-delivered-id"])
else:
return "skipped" # vectorset, ReJSON-RL, TSDB-TYPE, MBbloom-- ...
if pttl > 0:
p.pexpire(key, pttl)
p.execute()
return "copied"
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--source", required=True) # e.g. redis://old-host:6379/0
ap.add_argument("--target", required=True) # e.g. redis://valkey-host:6379/0
ap.add_argument("--match", default="*")
args = ap.parse_args()
src = redis.Redis.from_url(args.source)
dst = redis.Redis.from_url(args.target)
stats, skipped = collections.Counter(), collections.Counter()
for key in src.scan_iter(match=args.match, count=1000):
ktype = src.type(key).decode()
result = copy_key(src, dst, key, ktype)
stats[result] += 1
if result == "skipped":
skipped[ktype] += 1
print(dict(stats), "skipped types:", dict(skipped) or "none")
if __name__ == "__main__":
main()
Then compare the two sides key by key before you switch any client:
"""Compare source and target key by key: type, value and TTL (within 5 s)."""
import sys, redis
src = redis.Redis.from_url(sys.argv[1]); dst = redis.Redis.from_url(sys.argv[2])
def value(r, k, t):
if t == "string": return r.get(k)
if t == "list": return r.lrange(k, 0, -1)
if t == "set": return sorted(r.smembers(k))
if t == "zset": return r.zrange(k, 0, -1, withscores=True)
if t == "hash":
h = r.hgetall(k); return sorted(h.items()), [x > 0 for x in r.hpexpiretime(k, *h)]
if t == "stream": return r.xrange(k), sorted((g["name"], g["last-delivered-id"]) for g in r.xinfo_groups(k))
return None
bad = checked = 0
for k in src.scan_iter(count=1000):
t = src.type(k).decode(); checked += 1
ok = dst.type(k).decode() == t and value(src, k, t) == value(dst, k, t)
s, d = src.pttl(k), dst.pttl(k)
ok = ok and ((s < 0 and d < 0) or (s > 0 and d > 0 and abs(s - d) < 5000))
if not ok:
bad += 1; print("MISMATCH", k, t) if bad <= 5 else None
print(f"checked={checked} mismatches={bad} source_dbsize={src.dbsize()} target_dbsize={dst.dbsize()}")
In our run, Redis 8.12 held 20,506 keys: 20,000 cached strings (half with TTLs), 500 session hashes with a field TTL on the token, a list, a set, a 5,000-member sorted set, a 200-entry stream with a consumer group, a counter and one vector set. The script copied 20,505 keys in about four seconds on localhost, the verifier found one mismatch (the vector set, skipped by design), and field TTLs and the consumer group arrived intact. Running the script a second time produced the same result, because each key is deleted and rewritten in one transaction.
Know its limits before you use it:
- It copies a snapshot. Writes that land on the source during the copy are missed. Stop writes first (maintenance mode, paused workers), or accept that caches will refill and copy only the data that must survive, such as sessions and queues.
- Pending stream entries are not copied. Each consumer group is recreated at its last-delivered ID without its pending entries list, so messages that were delivered but not acknowledged would not be redelivered on Valkey. Let consumers finish and acknowledge before the move.
- Large keys are read whole. A list or hash with millions of members should be copied in chunks with
LRANGEorHSCANranges instead. - We tested a single non-clustered server. In cluster mode, run it per source primary and point it at a cluster-aware client.
If much of your data is cache, there is a simpler option: don't migrate it. Point the application at an empty Valkey, let the cache refill, and copy only the keys that hold state. Our article on Redis caching for SaaS APIs covers how to keep a cold cache from stampeding your database while it warms up.
Check the rest of the stack before cutover
- Job queues. Celery, RQ, Sidekiq and Laravel queues keep jobs in Redis lists, sorted sets or streams. Drain or pause workers before the copy so in-flight jobs are not lost. Our guides to Celery and Redis in Django and Laravel Horizon in production show where those keys live.
- Rate limiters and locks. Counters and lock keys with short TTLs can usually start fresh, but a limiter that resets during cutover lets a burst through. See our notes on API rate limiting patterns.
- Version checks. Search the codebase and your libraries for
redis_versioncomparisons; on Valkey they see 7.2.4. - Configuration. Valkey accepts Redis-style config files. Review persistence,
maxmemory-policy, ACL users and TLS settings rather than assuming defaults match. - Rollback. Valkey 9 writes RDB files with a
VALKEYsignature (VALKEY081from our 9.2.1 build) that Redis won't read, so the way back is the same key-level copy in the other direction. Keep the old server stopped but intact until you're confident.
What we tested and what we didn't
We compiled Redis 7.2.17, Redis 8.12.0 and Valkey 9.2.1 from their release tarballs and ran them on one Linux machine, without TLS, cluster mode, persistence tuning or the Redis 8 optional modules. Everything described above was observed there: the command lists, the redis-py compatibility run, the RDB, DUMP/RESTORE and replication failures in strict mode, the per-type relaxed loads, relaxed replication, replication from Redis 7.2 with promotion, and the copy and verify scripts shown here (which are the exact files we ran). The server_identity function was run against all three servers.
We did not test managed services (ElastiCache, Memorystore, Azure), Redis Cloud or Software, cluster-mode migrations, Sentinel failover, client libraries other than redis-py, module data types beyond one vector set, or performance. The pricing figures come from AWS's published page, not from a bill.
Making the call
For a typical SaaS backend that uses Redis for caching, sessions, queues and rate limits, Valkey is a straightforward choice today, and the work is in the migration, not the code. If you're on Redis 7.2, replication makes the move quick. If you're on Redis 7.4 or 8, inventory your data types first, rehearse on a copy of production data, and plan the write freeze. If you depend on vector sets or the Redis query engine, compare those features properly before you consider moving.
If you'd like a second pair of hands, CodeSapient builds and maintains SaaS backends in Django, Laravel and Node.js, including cache and queue infrastructure. You can tell us about your setup and we'll help you work out the safest path.
