Architecture
Coming Soon
Detailed architecture documentation is under construction and will be available in an upcoming release.
Overview
DbSync is built from the ground up on a Shared-Nothing, Thread-per-Core architecture. Unlike traditional databases that rely on mutex-protected shared data structures, DbSync partitions all state across CPU cores — achieving near-linear horizontal scaling on a single machine.
Design Philosophy
| Approach | Limitation |
|---|---|
| Single-threaded (Redis) | Cannot utilize multiple cores |
| Multi-threaded + locks | Lock contention grows with core count |
| Shared-nothing (DbSync) | Scales linearly with cores |
Key Architectural Concepts
- Shared-Nothing Model — Each core owns an exclusive shard of the data with its own hash map, slab allocator, and io_uring instance
- Thread-per-Core — One reactor thread pinned to each physical CPU core using
sched_setaffinity() - SPSC Inter-Thread Bus — Lock-free Single-Producer Single-Consumer ring buffers for cross-core request hopping
- Zero-Copy RESP Parser — Commands parsed using
std::string_viewinto the read buffer - Physical Core Affinity — Threads skip hyper-threaded siblings for exclusive L1/L2 cache access
Full Documentation Coming Soon
Detailed architecture deep-dives including diagrams for the shared-nothing model, request lifecycle, ITC bus design, memory management, and the io_uring I/O layer will be added in a future update.
In the meantime, check out:
- Commands — See the currently implemented commands
- Benchmarks — Performance data and comparisons