Redis is single-threaded. DragonflyDB is multi-threaded from the ground up — handling 25x more throughput on the same hardware while being API-compatible.
The Numbers
| Redis 7 | DragonflyDB | |
|---|---|---|
| Architecture | Single-threaded | Multi-threaded |
| Max throughput | ~1M ops/s (1 core) | ~25M ops/s (multi-core) |
| Memory efficiency | 1x | 2-5x better (shared nothing) |
| Snapshotting | Fork (2x RAM spike) | Incremental (no spike) |
| Max dataset size | Limited by 1 thread | Limited by total RAM |
| API compatible | — | 99%+ Redis/Memcached |
Setup
docker run --ulimit memlock=-1 -p 6379:6379 docker.dragonflydb.io/dragonflydb/dragonfly
Use your existing Redis client — zero code changes.
import Redis from "ioredis";
// Connects to DragonflyDB exactly like Redis
const redis = new Redis(6379, "localhost");
await redis.set("key", "value");
const val = await redis.get("key");
// All Redis commands work
await redis.hset("user:1", { name: "Alice", email: "alice@test.com" });
await redis.lpush("queue", "task1", "task2", "task3");
await redis.zadd("leaderboard", 100, "player1", 200, "player2");
Why Multi-Threading Matters
Redis uses 1 CPU core. On a modern 16-core server, you waste 15 cores or run 16 Redis instances (nightmare to manage).
DragonflyDB uses all cores automatically:
16-core server:
Redis: 1 instance per core × 16 = complex, shared-nothing, manual sharding
Dragonfly: 1 instance, uses all 16 cores = simple, automatic
Memory Efficiency
DragonflyDB uses a novel memory allocation strategy:
- No fork for snapshots — Redis forks the process for RDB saves, temporarily doubling RAM usage. Dragonfly uses incremental snapshots.
- Dash data structure — more compact than Redis's hash tables
- Result: Same data, 30-60% less RAM
Supported Commands
- All string commands (GET, SET, MGET, INCR, etc.)
- All hash commands (HSET, HGET, HGETALL)
- All list commands (LPUSH, RPOP, LRANGE)
- All set commands (SADD, SMEMBERS, SINTER)
- All sorted set commands (ZADD, ZRANGE, ZRANGEBYSCORE)
- Pub/Sub
- Streams
- Lua scripting
- Transactions (MULTI/EXEC)
- Cluster mode (emulated)
Configuration
docker run -p 6379:6379 docker.dragonflydb.io/dragonflydb/dragonfly \
--maxmemory 4gb \
--dbfilename dump \
--dir /data \
--proactor_threads 8
When to Use DragonflyDB
Choose DragonflyDB when:
- You need more throughput than single-threaded Redis
- Memory efficiency matters (large datasets)
- You want simpler ops (1 instance vs. Redis Cluster)
Stick with Redis/Valkey when:
- You need Redis Cluster (native, not emulated)
- Redis Modules (RediSearch, RedisJSON) are critical
- You want longest track record
Need high-performance data infrastructure? I build caching solutions and data tools. Email spinov001@gmail.com or check my Apify tools.
Top comments (0)