Architecture
How TeselaDB is built: equal nodes, replicated ranges and one thread per core.
This page tells what happens inside. You do not need it to use TeselaDB, but it helps you understand its guarantees and operate it. There is a version with diagrams in Architecture.
The pieces
| Piece | What it does |
|---|---|
| Node | One process per machine. All run the same binary and any of them takes requests from the drivers. |
| Core | Each node has one thread per CPU core, owner of its ranges, its log and its storage. |
| Range | An interval of keys of a collection, with its own Raft group. |
| Replica | A copy of a range on a node. One of them is the leader. |
| Group 0 | The metadata Raft group: nodes, catalogue, range descriptors and configuration. |
The path of a request
- Your driver sends the request to any node.
- That node's router finds which range holds each document and who its leader is.
- The leader evaluates the operation and proposes it on the range's Raft log.
- When a majority of the replicas have it on disk, it is applied and the node answers.
Storage
Each core has an LSM with a memtable, SST files and compaction, and keeps several versions of each document (MVCC). The core's Raft log also acts as the LSM's write-ahead log, so each write reaches the disk once.
Splitting on its own
A range splits when it holds more than 64 MiB of live data or receives more operations than its threshold. The balancer spreads replicas by count, load and free space, and leaders across nodes. Two small, cold neighbouring ranges merge.
Continue with Ranges and replicas.