FyroDB documentation
Introduction
What is FyroDB and why it exists.
Latest: v0.6.0 — parking_lot & atomic lock optimizations, exact CustomHash probing, seqlock inline string anti-tearing, and zero-overhead EBR reclamation.
What is FyroDB?
FyroDB is two things in one binary:
-
A Redis-compatible in-memory KV store — speaks RESP, works with every Redis client, SDK, and CLI tool without modification. Uses configurable mio workers and a sharded concurrent hash map with guarded value access. Performance depends on payloads, client behavior and CPU allocation; matched measurements are documented in the benchmarks.
-
A PostgreSQL query caching proxy — sits in front of any PostgreSQL database and intercepts SELECT queries. Cache hits are served directly from memory over the PostgreSQL wire protocol at 5M+ ops/sec, completely bypassing the database. The proxy speaks full PostgreSQL wire protocol (simple query + extended protocol / prepared statements), so your existing drivers and ORMs connect without any code changes.
Both engines run in one process with separate event loops while sharing CPU, memory and storage resources.
Key Features
KV Engine
- Redis-compatible — drop-in replacement, supports all major data types and 150+ commands
- Guarded concurrent reads — EBR lifetime protection plus entry guards or bounded map read admission
- In-place writes — per-key write guards and reusable value capacity; growth and contention can require allocation or retries
- Thread-per-core — one epoll loop per CPU, SO_REUSEPORT kernel accept
- Redis Cluster — 16384 hash slots, MOVED/ASK redirects, hash tags, gossip bus
- Direct GET replies — serialize protected stored values; eligible large batches use guarded scatter/gather
- 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 — shared encoded frames and grouped worker delivery, with completed recipient counts verified
DB Cache Proxy
- PostgreSQL query cache — proxy mode sits between your app and Postgres, caches SELECT results, serves hits at 5M+ ops/sec without touching the database
- Table-aware invalidation — cached results are invalidated automatically when the underlying tables change; INSERT/UPDATE/DELETE/DDL on
usersimmediately drops all cached results that touchedusers - Extended protocol support — prepared statements and parameterized queries are fully cached; parameters become part of the cache key fingerprint
- Isolated proxy threads — each client connection has its own thread, separate from the KV engine's event loops, with a configurable connection cap
- Per-session context fingerprinting —
search_path, timezone, and other session settings are mixed into cache keys, preventing cross-session cache confusion - SCRAM auth + connection pool — authenticates against upstream PostgreSQL and reuses connections across clients
Performance
KV Engine
Current benchmark evidence leads with our normal Go TCP suite. The retained d5a178b runtime measured 20.130M GET/s on one worker and 47.419M GET/s on six workers using three physical cores plus SMT with dedicated clients. A separate twelve-worker shared-client run measured 55.897M GET/s. These are three-run medians under different stated CPU budgets, not latency measurements or a guaranteed deployment rate.
The page includes every normal workload, official redis-benchmark comparisons with Dragonfly, earlier standalone Redis results, all tested payload sizes, memory, safety checks and rejected experiments. Historical higher best-of-three figures remain available separately; the latest admission-reuse candidate was reverted.
DB Cache Proxy
| Benchmark | Throughput |
|---|---|
| In-memory cache lookup | ~10M ops/sec |
| Encoded cache (wire-format) | ~7.6M ops/sec |
| Simple query TCP (cache hit) | ~7.6M ops/sec |
| Extended protocol TCP (cache hit) | ~5M ops/sec |
Historical proxy measurements on a six-core i5-11400H; no new proxy benchmark was run in the current KV campaign. Cache hits avoid forwarding the query upstream.
Links
- GitHub: github.com/Rana718/FyroDB
- Docker Hub: rana718/fyrodb
- Architecture deep-dive: Custom Concurrent HashMap in Rust