0 - Introduction | 中文
VRAFT is a framework written in C++ that implements the RAFT protocol and the SEDA architecture. Based on VRAFT, distributed software can be developed easily, such as distributed storage system and vectordb.
- Program with TLA+ Specification -- Coding with the assistance of TLA+ Specification to theoretically ensure the correctness of the system.
- Remu(Raft Emulator) -- There's a Built-in raft emulator that allows for distributed debugging, distributed global state viewing, and distributed automated testing.
- Debug Everything -- The full-stack source code of VRAFT can be debugged.
- Infrastructure Software Demo -- There are several demos of infrastructure software in VRAFT, such as distributed KV-store, metadata management center, distributed SQL, vectordb ...
- Basic Raft
- Raft Cluster Emulator
- Global State Change View
- Auto Message Flow
- Cluster Breakpoint Debugger
- Multi-Raft
- Pre-Vote
- Leadership Transfer
- Dynamic Membership Change
- Execution History CheckSum
- SEDA is a highly scalable internet software architecture, and VRAFT implements SEDA to support Multi-Raft.
- SEDA Paper
- Four types of threads:
- Server Thread: Implements TcpServer to receive messages from network.
- Client Thread: Implements TcpClient to send messages to network.
- Loop Thread: Implements EventLoop, used to respond to events (Raft messages, timer events, etc...)
- Work Thread: Implements producer-consumer model to process messages sequentially.
- Each type of thread has a corresponding thread pool, and the number of threads in the pool is configured based on the actual hardware conditions.
- Each Raft instance has a unique 64-bit RaftId, and this RaftId is included in Raft messages.
- Raft messages are passed between thread pools to complete the full Raft protocol process.
- Messages with the same RaftId are always processed by the same thread.
- A single thread can serve multiple different Raft instances.