Introduction
What is FyroDB and why it exists.
What is FyroDB?
FyroDB is a Redis-compatible in-memory key-value store written in Rust. It speaks the RESP protocol — any Redis client, SDK, or CLI tool works without modification.
Unlike Redis (single-threaded), FyroDB uses all CPU cores via a thread-per-core architecture with a fully lock-free concurrent hash map and per-key seqlock. A single FyroDB node outperforms a 6-node Redis Cluster on every workload while consuming lower memory and less CPU.
Key Features
- Redis-compatible — drop-in replacement, supports all major data types and 150+ commands
- Lock-free reads — epoch-based reclamation, seqlock validation for iteration safety
- Zero-clone writes — per-key spinlock with in-place mutation, no CAS retry loops
- Thread-per-core — one epoll loop per CPU, SO_REUSEPORT kernel accept
- Redis Cluster — 16384 hash slots, MOVED/ASK redirects, hash tags, gossip bus
- Zero-copy GET — writes directly from stored value to TCP buffer
- Full data type support — String, Hash, List, Set, Sorted Set, JSON, Stream, Bitmap, HyperLogLog, Geospatial
- RDB persistence — automatic snapshots, atomic saves, crash-safe
- Pub/Sub — 74.64M msg/sec delivery with lock-free Arc snapshots
Performance
| Benchmark | FyroDB (1 node) | Redis Cluster (6 nodes) | Speedup |
|---|---|---|---|
| Pipeline-64 SET | 8.95M ops/sec | 5.75M ops/sec | 1.6× |
| Pipelined SET | 20.08M ops/sec | 7.56M ops/sec | 2.7× |
| Pipelined GET | 28.16M ops/sec | 11.29M ops/sec | 2.5× |
| Pub/Sub publish | 1.49M ops/sec | 147.1K ops/sec | 10.1× |
| Pub/Sub delivery | 74.64M msg/sec | 7.35M msg/sec | 10.2× |
| Mixed SET/GET (50/50) | 20.90M ops/sec | 7.24M ops/sec | 2.9× |
| INCR (counters) | 50.11M ops/sec | 6.32M ops/sec | 7.9× |
| HSET/HGET (sessions) | 33.07M ops/sec | 7.95M ops/sec | 4.2× |
| LPUSH/RPOP (queue) | 39.26M ops/sec | 7.19M ops/sec | 5.5× |
| SADD (sets) | 27.87M ops/sec | 6.34M ops/sec | 4.4× |
| ZADD (zsets) | 18.12M ops/sec | 4.55M ops/sec | 4.0× |
| JSON.SET/GET (docs) | 14.91M ops/sec | 3.38M ops/sec | 4.4× |
| SET+EXPIRE (TTL) | 10.51M ops/sec | 2.64M ops/sec | 4.0× |
| Hot Key (contention) | 44.07M ops/sec | 2.03M ops/sec | 21.7× |
| Producer/Consumer | 36.20M ops/sec | 981.3K ops/sec | 36.9× |
Both sides tested on the same 6-core Intel i5-11400H (12 hardware threads): one single FyroDB node against a 6-node Redis Cluster (7 containers).
Links
- GitHub: github.com/Rana718/FyroDB
- Docker Hub: rana718/fyrodb
- Architecture deep-dive: Custom Concurrent HashMap in Rust