KeyDB on dedicated servers
KeyDB is a Redis-compatible data store that runs commands on several threads at once and lets two primaries replicate to each other. It suits teams who already use it or need those two features.
What is KeyDB?
A fork of Redis that added multithreading, active replication and other features while keeping the protocol, commands and data formats compatible. Clients, libraries and most tools work unchanged. It is BSD licensed and has been maintained by Snap since 2022. Release activity has slowed in recent years, so treat it as a stable piece of infrastructure to pin and test, and compare it with Valkey servers, which also uses several cores and is very active.
How does its threading work?
Several threads each run an event loop that accepts connections, parses commands and executes them, with locking around the shared data set. The server-threads setting chooses how many; four to eight covers most workloads, and beyond that lock contention limits gains. Pinning threads to cores with server-thread-affinity keeps caches warm.
# /etc/keydb/keydb.conf bind 127.0.0.1 10.60.0.1 port 6379 server-threads 6 server-thread-affinity true maxmemory 40gb maxmemory-policy allkeys-lfu appendonly yes appendfsync everysec requirepass use-a-long-random-secret
What is active replication?
Two KeyDB servers that are both primaries and replicas of each other. Writes can go to either, and each forwards them to the other. If one fails, clients continue on the other without a promotion step. Conflicts are resolved by last write wins, using timestamps, so design keys so that two writers rarely change the same key at once.
# on node A, with active-replica yes on both nodes keydb-cli -h 10.60.0.1 -a "$KDBPASS" REPLICAOF 10.60.0.2 6379 # on node B keydb-cli -h 10.60.0.2 -a "$KDBPASS" REPLICAOF 10.60.0.1 6379
Multi-master mode extends this to more than two nodes, each replicating from several others. Run replication over a WireGuard tunnel or KeyDB's TLS settings, because servers here talk over their public ports.
How do persistence and memory work?
Like Redis: RDB snapshots, the append-only file, or both. Snapshots fork the process and copy pages written during the save, so leave headroom: on a 64 GB machine, a 40 GB maxmemory is reasonable for a write-heavy instance. Set vm.overcommit_memory = 1 and turn off transparent huge pages. KeyDB also offers a mode that keeps part of the data set on flash storage; test it carefully before relying on it, and prefer keeping working data in memory.
How do I move between KeyDB and Redis or Valkey?
Through replication or RDB files. A Redis or Valkey server can replicate from KeyDB, and KeyDB from them, for data types they share; RDB files are compatible within the Redis 6 era feature set. Test with a copy of production data before switching, and check that modules or newer commands you rely on exist on the target. Our Redis servers page covers Redis itself.
Which machine fits?
Size memory by data set plus fork headroom, cores by the thread count you plan.
| Data set | Machine | Memory and cores |
|---|---|---|
| Up to 20 GB | ESSENTIAL-2 | 32 GB DDR4, 8 cores |
| Up to 40 GB, active pair | 2 x ESSENTIAL-S | 64 GB DDR5 each |
| Up to 80 GB | ESSENTIAL-5 | 128 GB DDR4, 24 cores |
An active pair of ESSENTIAL-S machines costs $46.20 a month each and keeps writes available through a full server failure. Place both in the same city or neighbouring ones, such as Roubaix and Gravelines, to keep replication lag low.
How do I monitor it?
With INFO and the usual Redis exporters, which work with KeyDB. Watch memory use against maxmemory, evictions, replication offset differences between the pair, and the latency of the slowest commands with SLOWLOG. Copy the RDB file to another machine daily, as Ship database dumps to a second server describes.
Machines for KeyDB
Lowest monthly price of each model across its data centres; the model page shows the price in every location.
| Model | Processor | Cores | Memory | Drives | Port | Per month |
|---|---|---|---|---|---|---|
| ESSENTIAL-2 | Intel Xeon-E 2388G | 8 | 32 GB | 2x 512 GB SSD NVMe | 1 Gbps unmetered | $43.20 |
| ESSENTIAL-S | AMD Ryzen 7 9700X | 8 | 64 GB | 2x 512 GB SSD NVMe | 1 Gbps unmetered | $46.20 |
| ESSENTIAL-M | AMD Ryzen 9 9900X | 12 | 64 GB | 2x 512 GB SSD NVMe | 1 Gbps unmetered | $70.80 |
| ESSENTIAL-4 | AMD EPYC 7313 | 16 | 64 GB | 2x 960 GB SSD NVMe | 1 Gbps unmetered | $106.20 |
| ESSENTIAL-5 | AMD EPYC 7413 | 24 | 128 GB | 2x 960 GB SSD NVMe | 1 Gbps unmetered | $120.00 |
| BUSINESS-2 2024 | AMD EPYC 4344P | 8 | 64 GB | 2x 960 GB SSD NVMe | 3 Gbps unmetered | $109.80 |
Run an active pair for availability; size memory for the data plus fork headroom.
Related pages
Valkey servers
Run Valkey, the open-source in-memory data store, on bare metal: I/O threads across cores, clusters, persistence, moving over from Redis and sizing.
Read moreRedis servers
Run Redis on your own hardware: persistence choices, fork memory headroom, Sentinel failover, cluster slots, the built-in data types of Redis 8 and sizing.
Read moreDatabase servers
NVMe machines with large memory for PostgreSQL, MySQL, MariaDB and MongoDB, from a single primary to replicated pairs.
Read moreShip database dumps to a second server
Schedule compressed, encrypted MariaDB or PostgreSQL dumps and send them to a Storage machine elsewhere, with retention and restore tests.
Read moreQuestions and answers
Is KeyDB compatible with Redis?
Yes. It keeps the Redis protocol, commands and data formats of its era, so clients and libraries work without changes.
How many threads should KeyDB use?
Four to eight server-threads covers most workloads; beyond that, lock contention limits gains.
What is KeyDB active replication?
Two KeyDB primaries replicate to each other, so writes can go to either and clients continue on one if the other fails.
Is KeyDB still maintained?
It is maintained by Snap, but release activity has slowed. Pin a tested version, and compare with Valkey for new deployments.
How much memory should KeyDB be allowed to use?
Leave headroom for snapshot forks: on a 64 GB machine, about 40 GB of maxmemory suits a write-heavy instance.