NOTE
4.2 Distributed-System Replication Architecture: Leaderless Replication
1. What Is Leaderless Replication - There is no Leader. When the client writes, it sends the write request to all replicas in parallel; when it reads, it similarly sends the read request to all replicas in parallel. 2. Leaderless Replication Use Cases. 3. How Leaderless Replication Works 3.1. Data Synchronization 3.1.1. Write-Conflict Problem.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is Leaderless Replication?
- There is no Leader. When the client writes, it sends the write request to all replicas in parallel; when it reads, it similarly sends the read request to all replicas in parallel.
2. Leaderless Replication Use Cases
3. How Leaderless Replication Works
3.1. Data Synchronization
3.1.1. Write-Conflict Problem
- Multiple clients are allowed to write the same key at the same time, which means there will be concurrency problems.
- As with Leader-Leader, LWW can be used, but it needs to be improved: not only does each key need a version, each replica also needs a version.
3.2. Failure Handling
- Suppose there are three replicas and two users.
- User 1 writes to replica1, replica2, and replica3:
- replica1 succeeds, replica2 succeeds, replica3 fails.
- User 2 reads from replica3 and reads old data.
3.2.1. Quorum Consistency
- Quorum writes and quorum reads:
- Write requests are sent to multiple nodes in parallel, and the write succeeds once the quorum of nodes succeeds.
- Read requests are sent to multiple nodes in parallel, and after the quorum of nodes returns successfully, take the data with the latest version number.
3.2.1.1. How Is the Quorum Determined?
- Suppose there are n replicas in total, each write needs confirmation from w nodes to succeed, and each read needs responses from r nodes to succeed. Then
w+r>n.
3.2.1.2. Limitations of Quorum
3.2.2. How to Repair Data After a Failed Node Restarts
3.2.2.1. Read Repair
- After parallel reads, overwrite the old version with the new version.
3.2.2.2. Anti-Entropy
- A background process scans and repairs.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub