Valkey is an open-source, in-memory key-value data store that keeps data structures such as strings, hashes, lists, sets and sorted sets in RAM and serves them over a simple network protocol with sub-millisecond latency. Among database systems in the field of databases, it belongs to the family of NoSQL key-value stores and is most often deployed as a cache, session store, message broker or real-time counter engine in front of a durable primary database.
Valkey began in March 2024 as a community fork of Redis 7.2.4, created after Redis changed its license away from the permissive BSD terms. The project is hosted by the Linux Foundation, remains under the BSD 3-Clause license, and is supported by several cloud providers and long-time Redis contributors. It stays wire-compatible with the Redis protocol, so most existing clients and commands work without modification.
How Valkey stores and serves data
Valkey serves every request from main memory, which is the main reason it answers reads and writes in tens to hundreds of microseconds. Clients connect over TCP or Unix sockets and speak RESP (REdis Serialization Protocol), a compact text-and-binary framing that keeps parsing overhead low.
Command execution runs on a single main thread, which makes each command atomic without locks: no two commands ever interleave on the same key. Since version 8.0, Valkey offloads network reading, writing and parsing to I/O threads, so the main thread spends most of its time executing commands. This design keeps the simple consistency model of classic Redis while using more CPU cores for networking.
Because RAM is volatile, Valkey offers two persistence mechanisms that can run separately or together. The table below summarizes them.
| Mechanism | How it works | Typical data loss on crash | Main cost |
|---|---|---|---|
| RDB snapshots | Forked child writes a point-in-time file | Minutes, depending on schedule | Fork memory overhead |
| AOF (append-only file) | Logs every write command | About one second with everysec | Larger files, rewrite cycles |
| RDB plus AOF | Snapshot base with command log | About one second | Highest disk usage |
| No persistence | Data lives only in RAM | All data | None; pure cache use |
Data structures and core features
Valkey is often called a data structure server because values are typed structures with dedicated server-side operations, not opaque blobs. Moving logic such as ranking, counting or set intersection to the server reduces round trips and keeps operations atomic.
| Data type | Example commands | Typical use |
|---|---|---|
| String | GET, SET, INCR | Cache entries, counters, locks |
| Hash | HSET, HGETALL | User profiles, object fields |
| List | LPUSH, BRPOP | Simple job queues |
| Set | SADD, SINTER | Tags, unique visitors |
| Sorted set | ZADD, ZRANGE | Leaderboards, rate limits |
| Stream | XADD, XREADGROUP | Event logs with consumer groups |
| Bitmap and HyperLogLog | SETBIT, PFCOUNT | Compact flags, approximate cardinality |
Other core features include key expiration (TTL), publish/subscribe messaging, transactions with MULTI and EXEC, and server-side Lua scripting and functions. Recent releases added per-field expiration in hashes, a redesigned internal hash table that lowers memory overhead per key, and a module system used for extensions such as JSON documents, Bloom filters and vector search.
Replication, high availability and clustering
Valkey scales and survives failures through asynchronous primary-replica replication. A replica receives a full snapshot first and then a continuous stream of write commands; because acknowledgment is asynchronous, a failover can lose the most recent writes that had not yet reached a replica.
- Sentinel monitors a primary and its replicas, elects a new primary on failure and tells clients the new address.
- Valkey Cluster shards data across nodes using 16,384 hash slots, with each key mapped by a CRC16 hash of its name.
- Multi-key commands in cluster mode work only when keys share a slot, which developers enforce with hash tags such as {user:42}.
- Newer versions support atomic slot migration and multiple logical databases in cluster mode, which earlier Redis clusters did not allow.
How Valkey compares with Redis and Memcached
Valkey is functionally close to Redis because both share the same code base up to version 7.2.4, yet the projects have diverged since 2024 in governance, licensing and new features. Memcached, another in-memory store in the same Topic, is simpler and multithreaded but offers only plain string values.
| Aspect | Valkey | Redis (8.x) | Memcached |
|---|---|---|---|
| License | BSD 3-Clause | RSALv2, SSPLv1 or AGPLv3 | BSD 3-Clause |
| Governance | Linux Foundation project | Single company | Community project |
| Data types | Rich structures and streams | Rich structures plus bundled modules | Strings only |
| Persistence | RDB and AOF | RDB and AOF | None |
| Replication and clustering | Built in | Built in | Client-side sharding only |
| Threading model | Single executor, threaded I/O | Single executor, threaded I/O | Fully multithreaded |
For most applications, migration from Redis 7.2 or earlier to Valkey is a drop-in replacement: data files, replication and the client protocol remain compatible. Compatibility is not guaranteed for features added to Redis after the fork, so teams using newer Redis-only commands or modules should test before switching.
When to use Valkey and what to watch
Valkey fits workloads where speed matters more than storage volume and where the data either has a durable copy elsewhere or can tolerate small losses. The decision table below maps common needs to a recommended approach.
| Situation | Recommended setup | Reason |
|---|---|---|
| Read-heavy web cache | Standalone with replicas, no persistence | Cache can be rebuilt from the database |
| Session storage | Primary and replica with AOF everysec | Limits logouts after a crash |
| Dataset larger than one node | Valkey Cluster with sharding | Spreads memory and throughput |
| Financial ledger | Use a relational database instead | Asynchronous replication can lose writes |
The most common mistakes are operational. Memory limits must be set with maxmemory and a suitable eviction policy such as allkeys-lru, or the server rejects writes or is killed by the operating system. Commands such as KEYS on large datasets block the single executor thread and stall every client, so SCAN should be used instead. Instances must never be exposed to the internet without authentication, ACLs and TLS, because unprotected instances are a frequent target of automated attacks.
The simple explanation
Valkey is like a very fast notepad kept in a computer’s memory instead of on its disk. Applications write small pieces of information there, such as who is logged in or which products are popular, and read them back almost instantly.
It started as a copy of the popular Redis software when that project changed its rules for use. Valkey keeps the free, open license, works the same way for most programs, and is maintained by a broad community. The key idea: Valkey makes applications faster by keeping frequently used data close at hand.
How it is used in practice
An online retailer runs its product catalog in PostgreSQL. During seasonal sales, product pages receive about 40,000 requests per second, and the database struggles with repeated identical queries. The engineering team places a three-node Valkey deployment in front of the database: one primary and two replicas managed by Sentinel.
Each product page is cached as a hash with a TTL of five minutes, and shopping carts are stored as hashes with AOF persistence set to everysec. A sorted set tracks the best-selling items in real time. The team sets maxmemory to 70 percent of available RAM with the allkeys-lru eviction policy.
After the change, more than 95 percent of catalog reads are served from Valkey, median page latency drops from roughly 120 ms to under 20 ms, and database CPU load falls enough to postpone a planned hardware upgrade. Because the team had previously run Redis 7.2, the switch required only new container images, not code changes.