Dragonfly is a Redis-compatible in-memory datastore that's 25x faster than Redis on multi-core machines. Drop-in replacement — same commands, same clients, way more speed.
Why Dragonfly?
- 25x faster: Multi-threaded architecture vs Redis single-thread
- Redis-compatible: Use existing Redis clients and commands
- Memory-efficient: Up to 40% less memory than Redis
- Snapshotting: Non-blocking snapshots
- Single binary: No cluster needed for high throughput
- Free: Open source, Apache 2.0
Docker Setup
docker run -p 6379:6379 docker.dragonflydb.io/dragonflydb/dragonfly
That's it. Your existing Redis clients connect without changes.
Use With Existing Redis Client
import { createClient } from 'redis';
const client = createClient({ url: 'redis://localhost:6379' });
await client.connect();
// Same Redis commands — works identically
await client.set('user:1', JSON.stringify({ name: 'Alice', role: 'admin' }));
const user = JSON.parse(await client.get('user:1'));
await client.hSet('session:abc', { userId: '1', loginAt: Date.now().toString() });
await client.expire('session:abc', 3600);
Python (same redis-py library)
import redis
r = redis.Redis(host='localhost', port=6379)
r.set('counter', 0)
r.incr('counter')
print(r.get('counter')) # b'1'
# Sorted sets
r.zadd('leaderboard', {'alice': 100, 'bob': 85, 'charlie': 92})
top3 = r.zrevrange('leaderboard', 0, 2, withscores=True)
BullMQ with Dragonfly
import { Queue, Worker } from 'bullmq';
// Just point BullMQ to Dragonfly — no code changes
const queue = new Queue('jobs', {
connection: { host: 'localhost', port: 6379 },
});
const worker = new Worker('jobs', async (job) => {
console.log('Processing:', job.data);
}, { connection: { host: 'localhost', port: 6379 } });
Pub/Sub
// Subscriber
const sub = client.duplicate();
await sub.connect();
await sub.subscribe('notifications', (message) => {
console.log('Received:', message);
});
// Publisher
await client.publish('notifications', 'New order #123');
JSON Support
# Store JSON natively
redis-cli JSON.SET user:1 $ '{"name":"Alice","scores":[95,87,92]}'
redis-cli JSON.GET user:1 $.scores
redis-cli JSON.NUMINCRBY user:1 $.scores[0] 5
Benchmark Comparison
| Operation | Redis | Dragonfly |
|---|---|---|
| SET (ops/sec) | 120K | 3.8M |
| GET (ops/sec) | 130K | 4.1M |
| Pipeline SET | 800K | 12M |
| Memory per key | 92 bytes | 56 bytes |
Real-World Use Case
A gaming company ran 3 Redis instances for session management (600K concurrent users). They replaced all 3 with 1 Dragonfly instance — same latency, 3x less memory, and saved $1,200/mo in cloud costs.
Need to automate data collection? Check out my Apify actors for ready-made scrapers, or email spinov001@gmail.com for custom solutions.
Top comments (0)