Consistency over Availability: How rqlite Handles the CAP theorem
18 days ago
- #CAP-theorem
- #distributed-database
- #rqlite
- rqlite is a lightweight, open-source, distributed relational database written in Go, using SQLite as its storage engine.
- The CAP theorem states that a distributed database cannot simultaneously provide Consistency, Availability, and Partition tolerance.
- Consistency (C) ensures all nodes have the same data at the same time.
- Availability (A) ensures every request receives a response, regardless of network issues.
- Partition tolerance (P) allows the system to function even during network failures.
- rqlite is a CP system, prioritizing consistency and partition tolerance using the Raft consensus protocol.
- rqlite offers selectable read consistency levels: weak, linearizable, strong, and none.
- Weak consistency is the default, providing fast reads with minimal risk of stale data.
- Strong consistency ensures data freshness but has a significant performance penalty.
- Linearizable reads balance performance and data correctness by confirming the leader's status with a quorum.
- None consistency offers maximum speed but no guarantees on data freshness.