Chain Replication (CR)
What’s Chain Replication?
- 系统构成:A list of servers, with a “head” and a “tail”;
- 写:
Client
sends toHead
, forward “write” tillTail
,Tail
responses toClient
; - 读:
Client
sends toTail
,Tail
response.
相对于 Raft,CR 的优点?
- 相对于
Leader
处理所有请求,将请求分散到Head
、Tail
能够提升服务吞吐量; - Raft 进行写时需要发送请求到所有 Replicas,然后等待 1/2 的响应,CR 则只需要将请求传递到后继节点,提升了写性能的吞吐量;
- CR 的写操作只需要一个服务器的介入;
- 错误恢复的流程更加简单(相当于在链表中删除一个节点);
Chain Replication with Apportioned Queries (CRAQ)
类似于在 ZooKeeper 设计中的思考,可以将 Read 的压力分散到各个不同的 Replicas 中。CRAQ 是一个基于 CR、并且将 Read 分散到各个节点、且满足 Linearizable
性质的分布式系统设计。
How does CRAQ support linearizable reads from any replica in the chain?
- 系统构成:Each replica stores a list of
versions
per object; - 写:Each
Replicas
create newdirty version
as write pass through,Tail
createsclean version
, and ACK it back along toHead
; - 读:
Client
sends to any node:- If latest version is clean, reply with that;
- If latest version is dirty, ask tail for latest version number.
CRAQ limitation?
If a node isn’t reachable, CRAQ must wait, so not immediately fault-tolerant in the way that ZK and Raft are.
Split brain
problem makes us can’t take over theHead
immediately.