What DragonflyDB Does
- Redis compatible — RESP protocol, most Redis commands
- Memcached compatible — text and binary protocols
- Multi-threaded — shared-nothing, scales across all cores
- Memory efficient — novel data structures use ~40% less RAM
- Snapshots — RDB-compatible persistence
- Replication — Redis-compatible replication protocol
- Pub/Sub — full pub/sub support
- Lua scripting — Redis Lua scripts work unchanged
- Cluster mode — emulated cluster for Redis cluster clients
- ACL — Redis-compatible ACL system
Architecture
Shared-nothing multi-threaded design: each thread owns a slice of the keyspace. No global locks. Novel dashtable data structure replaces Redis dict for lower memory overhead and better cache locality. IO is handled via io_uring (Linux) for minimal syscall overhead.
Self-Hosting
version: "3"
services:
dragonfly:
image: docker.dragonflydb.io/dragonflydb/dragonfly
ports: ["6379:6379"]
volumes:
- dragonfly-data:/data
ulimits:
memlock: -1
volumes:
dragonfly-data:Key Features
- Redis + Memcached wire compatibility
- 25x throughput vs Redis (single instance)
- 40% less memory usage
- Multi-threaded (shared-nothing)
- RDB snapshot persistence
- Replication
- Lua scripting
- ACL security
- io_uring (Linux)
- Drop-in replacement
Comparison
| Store | Threads | Protocol | Memory |
|---|---|---|---|
| DragonflyDB | Multi (shared-nothing) | Redis + Memcached | Best |
| Redis | Single | RESP | Good |
| Valkey | Single | RESP | Good (Redis fork) |
| KeyDB | Multi (shared) | RESP | Good |
| Garnet (MS) | Multi | RESP | Good |
FAQ
Q: Can it directly replace Redis? A: Yes in most scenarios. The RESP protocol is compatible, and most Redis commands are supported. A few advanced Redis features (Redis Modules, some cluster edge behaviors) are not.
Q: BSL restrictions? A: Automatically converts to Apache 2.0 after 4 years. In the meantime, self-use is completely fine; you just can't run a managed Dragonfly service competing with the official one.
Q: Why is it so fast? A: Multithreading + lock-free shared-nothing + io_uring + compact data structures (dashtable). A single machine can saturate a 96-core server.
Sources
- Docs: https://www.dragonflydb.io/docs
- GitHub: https://github.com/dragonflydb/dragonfly
- License: BSL 1.1