目录
正在加载目录…
正在阅读专栏 分布式共识系统专栏 第 22 篇 · 共 59 篇 · 37%

MIT 6.5840:Lecture 13 Chain Replication

发布于 2026-09-21 10:05 · 最后编辑于 2026-09-21 18:14 · 版本 v2 · 字数 18,798 · 预计阅读 38 分钟 👁 40 次阅读

本篇逐行译注 MIT 6.5840 Spring 2026 Lecture 13,覆盖 primary/backup、Chain Replication、ROWA、quorum、failure recovery、configuration service、sharding 与 repair speed。

MIT 6.5840:Lecture 13 Chain Replication

TL;DR

  • Chain Replication:把 primary/backup 的工作拆开,head 接收 updates 并排序,update 沿 chain 传播,tail 执行 reads 并向 client 回复。
  • ROWA:primary/backup 等待所有 replicas 确认 write,因此可以容忍 N-1 个 failures,但需要 configuration service 负责 failover 和 split-brain 防护。
  • Chain 的优势:head 的 network load 更小,head/tail 分担 client interaction,failure 后按顺序同步缺失 updates。
  • Chain 的限制:需要 CFG、对 slow replica 敏感、failure 后必须 reconfiguration,并且 tail/head lease 是 read/update 安全性的关键。
  • 大规模 sharding:把 data 切成远多于 servers 的 shards,让每个 server 参与许多 groups,并在 head、tail、middle 角色之间平衡负载和 repair。

名词解释

名词含义本讲对应物
Primary/backupprimary 排序并向所有 backups 复制ROWA 风格复制
Chain Replicationreplicas 排成 head→middle→tail 的 chainupdate 从 head 传播到 tail
ROWARead One Write Allread 从一个副本,write 等所有副本
CFGconfiguration service管理 primary/head/tail、failover 和 lease
Headchain 的入口节点分配 sequence numbers、接收 updates
Tailchain 的末端节点执行 reads、回复 update/client
Quorumreplicas 的多数派Raft/Paxos 的容错基础
Rndparrandom/分散的 shard placement 思路并行 repair 与负载均衡

目录

章节内容
版本与来源固定 Lecture 13 源文件与论文
原文逐行翻译按 l-cr.txt 顺序译注
机制小结Chain Replication、CFG、sharding 与 repair
本篇验收源行、图示和术语边界记录

版本与来源

  • 课程版本:MIT 6.5840 Spring 2026。
  • Lecture 源文件:l-cr.txt,357 行,非空源行 316 行,SHA-256:12b6186c829185f6dfa6af9095c50466a4704bf0db5aa2f626eb7c813a95857b。
  • 配套论文:Chain Replication for Supporting High Throughput and Availability。
  • 课程日程:MIT 6.5840 Spring 2026 Schedule。
  • 翻译边界:英文源行按原顺序保留,随后给出中文译文;primary、backup、chain、head、tail、CFG、ROWA、quorum、Paxos、Raft、lease 和 Figure/Section 编号原样保留。
  • 图片结论:本 Lecture 源文件没有独立图片文件;[diagram: ...]、Chain/primary-backup ASCII 示意、sharding diagram 和 Figure 引用按原位置保留。

原文逐行翻译

课程主题与两种 RSM 组织方式

6.5840 2026 Lecture 13: Chain Replication

6.5840 2026 年 Lecture 13:Chain Replication。

Chain replication for supporting high throughput and availability

用于支持 high throughput 和 availability 的 Chain Replication。

(OSDI 2004) by Renesse and Schneider

(OSDI 2004),作者为 Renesse 和 Schneider。

a couple of topics today:

今天讨论几个主题:

replicated state machines

replicated state machines。

revisit primary/backup replication

重新讨论 primary/backup replication。

chain replication as a better primary/backup

把 chain replication 作为更好的 primary/backup。

compare p/b vs chain vs quorum

比较 p/b、chain 和 quorum。

structure of sharded systems

sharded systems 的结构。

two approaches to replicated-state machine

replicated-state machine 有两种 approaches。

  1. run all ops through Raft/Paxos (lab 3)
  1. 让所有 ops 通过 Raft/Paxos(Lab 3)。
  1. configuration server plus primary-backup
  1. configuration server 加 primary-backup。
  GFS master + chunk replication

GFS master + chunk replication。

  VM-FT: test-and-set + P/B replication

VM-FT:test-and-set + P/B replication。

  zookeeper + primary-backup

ZooKeeper + primary-backup。

configuration server must be fault-tolerant

configuration server 必须是 fault-tolerant 的。

why approach 2?

为什么采用 approach 2?

separation of concerns

separation of concerns。

configuration srv stores configuration info

configuration srv 存储 configuration info。

  who is primary, which server has what shard

谁是 primary,哪个 server 拥有哪些 shard。

  who is the head of the chain

谁是 chain 的 head。

  must handle split-brain syndrome

必须处理 split-brain syndrome。

    often uses paxos/raft

通常使用 Paxos/Raft。

    can proceed with majority

可以依靠 majority 继续运行。

data replication protocol

data replication protocol。

  primary-backup, chain replication or whatever

primary-backup、chain replication 或其他 protocol。

  often simpler than raft (figure 2); doesn't need to handle split brain

通常比 Raft 更简单(Figure 2);不需要处理 split brain。

  can proceed if only 1 server is available (after reconfiguration)

(reconfiguration 后)即使只有 1 个 server 可用,也可以继续运行。

Primary/backup

primary/backup (paper's Section 4)

primary/backup(论文 Section 4)。

old, widely used in various forms

它很 old,并以各种形式被广泛使用。

GFS uses a (non-strict) p/b scheme for chunks

GFS 对 chunks 使用一种(non-strict)p/b scheme。

CR paper is an improved p/b

CR 论文提出了改进版 p/b。

the basic primary/backup arrangement

基本的 primary/backup arrangement。

[diagram: CFG, clients, primary, two backups, state = key/value table]

[diagram:CFG、clients、primary、两个 backups、state = key/value table]。

primary numbers ops, to impose order if concurrent client ops arrive

primary 为 ops 编号;如果 concurrent client ops 到达,就用它们施加 order。

primary forwards each to backups (in parallel)

primary 将每个 op(并行地)forward 给 backups。

primary waits for response from ALL backups, replies to client

primary 等待 ALL backups 的 response,然后回复 client。

primary can respond to reads w/o sending to backups

primary 可以不向 backups 发送请求就响应 reads。

if primary fails, one of the backups becomes new primary

如果 primary failure,某个 backup 成为 new primary。

can proceed if even a single replica survives

即使只有一个 replica 存活,也可以继续运行。

so N replicas can survive N-1 failures -- better than Raft

因此 N 个 replicas 可以承受 N-1 个 failures——比 Raft 更好。

a separate configuration service (CFG) manages failover

独立的 configuration service(CFG)管理 failover。

configuration = identity of current primary and backups

configuration = 当前 primary 和 backups 的 identity。

usually built on Paxos or Raft or ZooKeeper

通常建立在 Paxos、Raft 或 ZooKeeper 之上。

pings all servers to detect failures

它 ping 所有 servers 来检测 failures。

CFG must include at least one replica from

CFG 必须至少包含一个来自

  previous configuration in any new configuration.

previous configuration 的 replica,且该 replica 必须出现在任何 new configuration 中。

if a backup fails, CFG must remove it from the configuration,

如果 backup failure,CFG 必须把它从 configuration 中移除,

b/c the primary has to wait for all backups

因为 primary 必须等待所有 backups。

sometimes called ROWA (Read One Write All), as opposed to quorum

它有时称为 ROWA(Read One Write All),与 quorum 相对。

the "write all" is what allows us to tolerate N-1 failures

“write all”使系统能够容忍 N-1 failures。

since every replica has all committed values, unlike quorums

因为与 quorums 不同,每个 replica 都拥有所有 committed values。

强复制 scheme 的检查项

a few key properties we need to check for any strong replication scheme:

对于任何 strong replication scheme,需要检查几个关键 properties:

  1. never reveal uncommitted data
  1. 永远不能 reveal uncommitted data。
 i.e. data that might not survive a tolerated failure

也就是不能 reveal 可能无法在 tolerated failure 后存活的数据。

  1. after failure recovery, all replicas must agree!
  1. failure recovery 后,所有 replicas 必须 agree!
 if one saw last msg from primary, but the other did not

否则可能出现一个看到了 primary 的最后一条 msg,而另一个没有看到。

  1. no split brain if network partitions
  1. network partitions 时不能 split brain。
 only one new primary; old primary must stop

只能有一个 new primary;old primary 必须停止。

  1. able to recover after a complete failure
  1. 能够在 complete failure 后 recovery。
  1. handle retried client requests
  1. 处理 retried client requests。

#1 for primary/backup?

primary/backup 如何满足 #1?

example bad situation:

坏情况示例:

put(x, 99) arrives at primary

put(x, 99) 到达 primary。

get(x) immediately follows it

get(x) 紧接着到达。

  before primary gets backups' responses to put(x,99)

但此时 primary 还没有收到 backups 对 put(x,99) 的 responses。

we said primary can serve reads w/o talking to backups

我们之前说过 primary 可以不与 backups 通信就服务 reads。

but it's not safe to return 99!

但返回 99 并不 safe!

answer: either respond with old value,

答案:要么返回 old value,

or block read until all backups respond to put(x,99).

要么 block read,直到所有 backups 都对 put(x,99) 回复。

#2 for primary/backup?

primary/backup 如何满足 #2?

new primary could merge all replicas' last few operations.

new primary 可以 merge 所有 replicas 的最后几项 operations。

or, elect as primary the backup that received the highest # op.

或者选择收到最高 op number 的 backup 作为 primary。

and new primary must start by forcing backups to agree with it

并且 new primary 必须先强制 backups 与自己 agree。

#3 for primary/backup?

primary/backup 如何满足 #3?

how to prevent backup from taking over if partitioned from primary?

如果 backup 与 primary partition,如何防止 backup 接管?

and primary is still alive.

而 primary 仍然 alive。

*don't* have backups make this decision!

不要让 backups 做这个 decision!

only the CFG can declare a new primary + backups.

只有 CFG 能够 declare new primary + backups。

  based on CFG's opinion of which servers it can reach.

依据 CFG 对自己能够 reach 哪些 servers 的判断。

what if the old primary is actually alive, but CFG can't talk to it?

如果 old primary 实际上 alive,但 CFG 无法与它通信呢?

how to prevent old primary from serving requests?

如何防止 old primary 服务 requests?

for updates:

对于 updates:

  old primary cannot respond to client requests until all

old primary 不能响应 client requests,直到 configuration 中的所有

    replicas in its configuration reply

replicas 都 reply。

  at least one replica must be part of the new configuration

至少一个 replica 必须属于 new configuration。

  so replicas must be careful not to reply to an old primary!

因此 replicas 必须小心,不能回复 old primary!

for reads:

对于 reads:

  primary doesn't have to talk to backups for reads

primary 不必为了 reads 与 backups 通信。

  so CFG must grant lease to primary

因此 CFG 必须向 primary 授予 lease。

#5 for primary/backup?

primary/backup 如何满足 #5?

server does duplicate detection keeps a reply table with sent responses

server 执行 duplicate detection,并用 reply table 保存已经发送的 responses。

the client clerk stamps each request with a nonce (unique id)

client clerk 为每个 request 加上 nonce(unique id)。

server checks if already responded to that nonce

server 检查是否已经对该 nonce 回复过。

other solution:

另一种 solution:

add version# to put and store version # with key  (lab 2)

为 put 增加 version#,并把 version # 与 key 一起存储(Lab 2)。

Chain Replication 的动机

Chain Replication was published at a time when only a few people

Chain Replication 发表时,只有少数人

understood the detailed design of strongly consistent replication;

理解 strongly consistent replication 的 detailed design;

it's been influential, and a fair number of real-world systems build

它很有影响力,许多 real-world systems 都建立

on it.

在它之上。

what p/b problems does Chain Replication aim to fix?

Chain Replication 试图修复 p/b 的哪些问题?

  1. primary has to do a lot of work
  1. primary 必须做很多 work。
  1. primary has to send a lot of network data
  1. primary 必须发送大量 network data。
  1. re-sync after primary failure is complex, since backups may differ
  1. primary failure 后的 re-sync 很 complex,因为 backups 可能不同。

the basic Chain Replication idea:

Chain Replication 的基本 idea:

[clients, S1=head, S2, S3=tail, CFG (= master)]

[clients, S1=head, S2, S3=tail, CFG (= master)]。

(can be more replicas)

(可以有更多 replicas。)

clients send updates requests to head

clients 将 updates requests 发送给 head。

head picks an order (assigns sequence numbers)

head 选择 order(分配 sequence numbers)。

head updates local replica, sends to S1

head 更新 local replica,并发送给 S1。

S1 updates local replica, sends to S2

S1 更新 local replica,并发送给 S2。

S2 updates local replica, sends to S3

S2 更新 local replica,并发送给 S3。

S3 updates local replica, sends response to client

S3 更新 local replica,并向 client 发送 response。

updates move along the chain in order:

updates 按 order 沿 chain 移动:

  at each server, earlier updates delivered before later ones

在每个 server 上,earlier updates 都在 later updates 之前 delivered。

clients send read requests to tail

clients 将 read requests 发送给 tail。

tail reads local replica and responds to client

tail 读取 local replica 并响应 client。

benefit: head sends less network data than a primary

优势:head 比 primary 发送更少的 network data。

benefit: client interaction work is split between head and tail

优势:client interaction work 在 head 和 tail 之间分担。

The Question: Suppose Chain Replication replied to update requests

问题:假设 Chain Replication 对 update requests 的回复

from the head, as soon as the next chain server said it received the

来自 head:只要下一个 chain server 表示它收到了

forwarded update, instead of responding from the tail. Explain how

forwarded update,就立即回复,而不是由 tail 回复。解释这如何

that could cause Chain Replication to produce results that are not

可能导致 Chain Replication 产生不

linearizable.

linearizable 的 results。

Chain failure recovery

what if the head fails?

如果 head failure 了怎么办?

the CFG (master) is in charge of recovering from failures

CFG(master)负责从 failures 中 recovery。

CFG tells 2nd chain server to be new head

CFG 告诉第 2 个 chain server 成为 new head。

and tells clients who the new head is

并告诉 clients new head 是谁。

will all (remaining) servers still be exact replicas?

所有(remaining)servers 仍然会是 exact replicas 吗?

they will soon!

它们很快就会是!

in-order delivery means each server is identical

in-order delivery 意味着每个 server 都与

  to the one before it, just missing last few updates

它前面的 server identical,只是缺少最后几项 updates。

so each server needs to compare notes with successor and

因此每个 server 只需要与 successor compare notes,并

  just send those last few updates

发送最后几项 updates。

some client update requests may be lost

一些 client update requests 可能丢失。

if only the failed head knew about them

如果只有 failed head 知道它们。

clients won't receive responses

clients 不会收到 responses。

and will eventually re-send to new head

最终会把 requests re-send 给 new head。

what if the tail fails?

如果 tail failure 了怎么办?

CFG tells next-to-last server to be new tail

CFG 告诉倒数第二个 server 成为 new tail。

and tells clients, for read requests

并针对 read requests 告诉 clients 这一点。

next-to-last is at least as up to date as the old tail

倒数第二个 server 至少与 old tail 一样 up to date。

for updates that new tail received but old tail didn't,

对于 new tail 已收到但 old tail 没收到的 updates,

system won't send responses to clients.

system 不会向 clients 发送 responses。

clients will time out and re-send

clients 会 timeout 并 re-send。

Section 2 says clients are responsible for checking

Section 2 说 clients 负责检查

  whether timed-out operations have actually already

timed-out operations 是否实际上已经

  been executed (often harder than it sounds).

executed(通常比听起来更难)。

what if an intermediate server fails?

如果 intermediate server failure 了怎么办?

CFG tells previous/next servers to talk to each other

CFG 告诉 previous/next servers 互相通信。

previous server may have to re-send some updates that

previous server 可能必须重新发送一些

it had already sent to failed server

它之前已经发送给 failed server 的 updates。

note that servers need to remember updates even after forwarding

注意,servers 在 forwarding 后仍需要记住 updates。

in case a failure requires them to re-send

以便 failure 要求它们 re-send 时使用。

when to free?

什么时候可以 free?

tail sends ACKs back up the chain as it receives updates

tail 收到 updates 后,沿 chain 向上发送 ACKs。

when a server gets an ACK, it can free all through that op

server 获得 ACK 后,就可以 free 一直到该 op 的所有数据。

未提交 update 与扩展 chain

what's the argument that CR won't reveal an uncommitted update?

CR 不会 reveal uncommitted update 的依据是什么?

i.e. could client read a value,

也就是说,client 是否可能读到一个 value,

but it then disappears due to a tolerated failure?

但该 value 随后因为 tolerated failure 消失?

or could a client get a "yes" response to an update,

或者 client 是否可能对 update 收到“yes” response,

but then it's not there after a failure?

但 failure 后该 update 不再存在?

reads come from the tail

reads 来自 tail。

the tail only sees an update after every other server sees it

tail 只有在其他每个 server 都看到 update 后才会看到它。

so after a failure, every server still has that update

所以 failure 后,每个 server 仍然拥有该 update。

update is responded to after it gets to the tail

update 到达 tail 后才会得到 response。

at which point every server has it

在该时刻每个 server 都拥有它。

how to add a new server? ("extend the chain")

如何添加 new server?(“extend the chain”)

you need to do this to restore replication level after a failure.

failure 后需要这样做以恢复 replication level。

again, CFG manages this

同样,这由 CFG 管理。

new server is added at the tail

new server 被添加到 tail。

a slow possibility:

一种 slow possibility:

tell the old tail to stop processing updates

告诉 old tail 停止处理 updates。

tell the old tail to send a complete copy of its data to the new tail

告诉 old tail 将完整 data copy 发送给 new tail。

tell the old tail to start acting as an intermediate server,

告诉 old tail 开始作为 intermediate server,

  forwarding to the new tail

向 new tail forwarding。

tell the new tail to start acting as the tail

告诉 new tail 开始作为 tail。

tell clients about new tail

告诉 clients new tail。

slow b/c we're pausing all updates for minutes or hours

这很 slow,因为要 pause 所有 updates 几分钟或几小时。

better is to transfer a snapshot of the state in advance

更好的方式是提前 transfer state 的 snapshot。

then freeze the system just long enough to send the

然后只 freeze system 足够长的时间,以发送

  last few updates to the new tail

最后几项 updates 给 new tail。

then reconfigure and un-freeze

然后 reconfigure 并 un-freeze。

perhaps use ZooKeeper's fuzzy snapshot idea

也许可以使用 ZooKeeper 的 fuzzy snapshot idea。

Partition 与 lease

partition situation is much as in p/b

partition situation 与 p/b 中的情况很相似。

CFG makes all decisions

所有 decisions 都由 CFG 做出。

it will pick a single new head &c

它会选择一个 single new head 等。

based on its view of server liveness -- i.e. just in CFG's partition

依据它对 server liveness 的 view——也就是 CFG 自己所在的 partition。

new head is old 2nd server, it should ignore

new head 是 old 2nd server;它应该忽略

updates from the old head, to cope with "what if old

来自 old head 的 updates,以处理“如果 old

head is alive but CFG thinks it has failed"

head alive,但 CFG 认为它 failure 了”的情况。

CFG needs to grant tail a lease to serve client reads,

CFG 需要向 tail 授予 lease,以便服务 client reads,

and not designate a new tail until lease has expired

并且在 lease expired 前不能 designate new tail。

p/b、chain 与 quorum 的比较

p/b versus chain replication?

p/b 与 chain replication 的比较?

p/b may have lower latency (for small requests)

p/b 可能拥有更低的 latency(对于 small requests)。

chain head has less network load than primary

chain head 比 primary 的 network load 更小。

important if data items are big (as with GFS)

如果 data items 很大(如 GFS 中),这一点很重要。

chain splits work between head and tail

chain 在 head 和 tail 之间分配 work。

primary does it all, maybe more of a bottleneck

primary 做所有 work,可能更容易成为 bottleneck。

chain has simpler story for which server should take over if head fails,

chain 更容易说明 head failure 后哪个 server 应该接管,

and how ensure servers get back in sync

以及如何确保 servers 重新 sync。

chain (or p/b) versus Raft/Paxos/Zab (quorum)?

chain(或 p/b)与 Raft/Paxos/Zab(quorum)的比较?

p/b can tolerate N-1 of N failures, quorum only N/2

p/b 可以容忍 N 个中的 N-1 个 failures,quorum 只能容忍 N/2。

p/b simpler, maybe faster than quorum

p/b 更简单,可能比 quorum 更快。

p/b requires separate CFG, quorum self-contained

p/b 需要单独的 CFG,quorum 是 self-contained 的。

p/b must wait for reconfig after failure, quorum keeps going

p/b 必须等待 failure 后的 reconfig,quorum 可以继续运行。

p/b slow if even one server slow, quorum tolerates temporary slow minority

只要有一个 server slow,p/b 就会 slow;quorum 能容忍 temporary slow minority。

p/b CFG's server failure detector hard to tune:

p/b 的 CFG server failure detector 很难 tune:

any failed server stalls p/b, so want to declare failed quickly!

任何 failed server 都会 stall p/b,因此希望快速 declare failed!

but over-eager failure detector will waste time copying data to new server.

但过于 eager 的 failure detector 会浪费时间把 data copy 到 new server。

quorum system handles short / unclear failures more gracefully

quorum system 能更 graceful 地处理 short / unclear failures。

for a long time p/b (and chain) dominated data replication

很长一段时间里,p/b(以及 chain)主导了 data replication。

Paxos was viewed as too complex and slow for high-performance DBs

Paxos 被认为对于 high-performance DBs 来说过于 complex 且 slow。

recently quorum systems have been gaining ground

最近 quorum systems 逐渐获得更多采用。

due to good toleration of temporarily slow/flaky replicas

因为它们能很好地容忍 temporarily slow/flaky replicas。

大规模 sharding

what if you have too much data to fit on a single replica group?

如果 data 太多,无法放入单个 replica group 呢?

e.g. millions of objects

例如 millions of objects。

you need to "shard" across many "replica groups"

你需要跨许多“replica groups”进行“shard”。

sharding diagram:

sharding diagram:

[CFG, G1, G2, .., Gn, clients]

[CFG、G1、G2、..、Gn、clients]。

GFS looked like this

GFS 看起来就是这样。

modern system might use ZK for CFG, chain or p/b or Raft for data

modern system 可能使用 ZK 作为 CFG,使用 chain、p/b 或 Raft 处理 data。

how to lay out chains on server in a big sharding setup?

在 big sharding setup 中,如何把 chains 布置到 servers 上?

the paper's 5.2 / 5.3 / 5.4

参见论文的 5.2 / 5.3 / 5.4。

a not-so-great chain or p/b sharding arrangement:

一种不太好的 chain 或 p/b sharding arrangement:

each set of three servers serves a single shard / chain

每组三个 servers 服务一个 single shard / chain。

shard A: S1 S2 S3

shard A: S1 S2 S3。

shard B: S4 S5 S6

shard B: S4 S5 S6。

problem: some servers will be more loaded than others

问题:一些 servers 的 load 会比其他 servers 高。

the primary in each group will be slow while the others have idle capacity

每个 group 的 primary 会很 slow,而其他 servers 有 idle capacity。

the head and tail will be more loaded than the middle

head 和 tail 的 load 会高于 middle。

the under-loaded servers waste money!

under-loaded servers 浪费 money!

problem: replacing a failed replica takes a long time!

问题:replace failed replica 需要很长时间!

the new server must fetch a whole disk of data over the network

new server 必须通过 network fetch 一整块 disk 的 data,

  from one of the remaining replicas

来源是 remaining replicas 中的一个。

a terabyte at a gigabit/second takes two hours!

以 gigabit/second 传输一个 terabyte 需要 two hours!

significant risk of remaining replicas failing before completion!

在完成之前 remaining replicas 也 failure 的 risk 很大!

a better plan ("rndpar" in Section 5.4):

更好的 plan(Section 5.4 中的“rndpar”):

split data into many more shards than servers

把 data split 成远多于 servers 数量的 shards。

(so each shard is much smaller than in previous arrangement)

(因此每个 shard 比之前 arrangement 中小得多。)

each server is a replica in many shard groups

每个 server 都是许多 shard groups 的 replica。

shard A: S1 S2 S3

shard A: S1 S2 S3。

shard B: S2 S3 S1

shard B: S2 S3 S1。

shard C: S3 S1 S2

shard C: S3 S1 S2。

(this is a regular arrangement, but in general would be random)

(这是一个 regular arrangement,但一般情况下会是 random 的。)

for p/b, a server is primary in some groups, backup in other

对于 p/b,一个 server 在一些 groups 中是 primary,在另一些中是 backup。

for chain, a server is head in some, tail in others, middle in others

对于 chain,一个 server 在一些 groups 中是 head,在另一些中是 tail,在另一些中是 middle。

now request processing work is likely to be more balanced

这样 request processing work 可能更加 balanced。

how does rndpar do for repair speed?

rndpar 的 repair speed 如何?

suppose one server fails.

假设一个 server failure。

say it participated in M replica groups, for M shards.

假设它参与了 M 个 replica groups,也就是 M 个 shards。

instead of designating a single replacement server, let's

不要 designate 一个 single replacement server,而是

choose M replacement servers, a different one for each shard.

选择 M 个 replacement servers,每个 shard 对应一个不同的 server。

these are existing servers, which we're giving a new responsibility.

这些都是 existing servers,只是赋予它们 new responsibility。

now repair of the M shards can go on in parallel!

现在 M 个 shards 的 repair 可以 parallel 进行!

instead of taking a few hours, it will take 1/M'th that time.

不再需要 few hours,而只需要其 1/M 的时间。

how does rndpar do if three random servers fail?

如果 three random servers failure,rndpar 如何表现?

as the number of shards on each server increases, it gets more

随着每个 server 上的 shards 数量增加,出现这种情况的概率更

likely that *some* shard had its three replicas on

高:some shard 的三个 replicas 恰好位于

the three random servers that failed.

failure 的三个 random servers 上。

this is not ideal.

这并不 ideal。

rndpar gives us fast repair, but it's somewhat undermined

rndpar 提供 fast repair,但它在一定程度上被

by higher probability that a few failures wipes out all

少数 failures wipe out 某个 shard 的所有

replicas for some shard (Figure 7).

replicas 的更高概率削弱了(Figure 7)。

Conclusion 与 take-away

conclusion

结论。

Chain Replication is one of the clearest descriptions of a ROWA scheme

Chain Replication 是对 ROWA scheme 最清晰的描述之一。

it does a good job of balancing work

它很好地完成了 work balancing。

it has a simple approach to re-syncing replicas after a failure

它提供了 failure 后 re-syncing replicas 的简单方法。

influential: used in EBS, Ceph, Parameter Server, COPS, FAWN.

它很 influential:被用于 EBS、Ceph、Parameter Server、COPS、FAWN。

it's one of a number of designs (p/b, quorums) with different properties

它是许多具有不同 properties 的 designs(p/b、quorums)之一。

5.1 take-away:

5.1 takeaway:

chain throughput as high as p/b b/c limited by head/primary CPU

chain 的 throughput 与 p/b 一样高,因为两者都受 head/primary CPU 限制。

for 0% updates, chain limited by tail alone, and p/b limited by prim alone

在 0% updates 时,chain 只受 tail 限制,而 p/b 只受 prim 限制。

for 100% updates, chain limited by head alone, and p/b limited by prim alone

在 100% updates 时,chain 只受 head 限制,而 p/b 只受 prim 限制。

only in the middle is there a difference b/c chain splits work

只有在中间区域才有差异,因为 chain 拆分 work

between head and tail

到 head 和 tail 之间。

BUT network communication assumed to be free; in real life

BUT 这里假设 network communication 是 free 的;现实中

p/b has a problem b/c prim must send to all backups

p/b 有问题,因为 prim 必须向所有 backups 发送。

BUT write latency is a problem in the real world, since

BUT write latency 在现实世界中是个问题,因为

client often waiting for "committed" reply

client 经常等待“committed” reply。

5.2 take-away:

5.2 takeaway:

assume 1000s of chains and dozens of servers.

假设有 1000s 个 chains 和 dozens 个 servers。

idea: split your data over many chains, and the chains

idea:把 data split 到许多 chains 上,并把 chains

over a modest number of servers, so that every server

分布到适量的 servers 上,使得每个 server

is in many chains, some as head, some as tail, some

都参与 many chains:一些作为 head,一些作为 tail,一些

in the middle

作为 middle。

this balances the load of being head and tail vs middle.

这会平衡作为 head/tail 与作为 middle 的 load。

Figure 5 doesn't seem to say much, maybe just that if

Figure 5 似乎没有说明太多,也许只是说明如果

you have only 25 clients, then there's not much point

只有 25 clients,那么没有太大必要

in having more than about 25 servers.

拥有超过大约 25 个 servers。

5.3 take-away:

5.3 takeaway:

assume 1000s of chains and dozens of servers.

假设有 1000s 个 chains 和 dozens 个 servers。

repair time is a big deal, since a single server can store

repair time 很重要,因为单个 server 可以存储

so much data that it takes hours to transfer over a

如此多 data,以至于通过一条

single network link.

single network link 传输需要数小时。

when a single server fails, need to spread responsibility

当一个 single server failure 时,需要分散

for the data it replicated over *multiple* other servers,

它所 replication 的 data 的 responsibility 到 multiple other servers,

to get fast parallel repair.

以获得 fast parallel repair。

5.4 take-away:

5.4 takeaway:

assume 1000s of chains and dozens of servers.

假设有 1000s 个 chains 和 dozens 个 servers。

best for parallel recovery speed is if no constraints and

对于 parallel recovery speed,最好的情况是没有 constraints,并且

random placement, so that both sources and destinations

采用 random placement,使 recovery traffic 的 sources 和 destinations

of recovery traffic are evenly-ish spread after a single

在单个

failure.

failure 后都能大致均匀地分布。

BUT if chains are randomly spread over servers, then any

BUT 如果 chains random 地分布在 servers 上,那么 any

combination of three (if chainlen=3) random server failures

三个(如果 chainlen=3)random server failures 的 combination

has a good chance of destroying all replicas of *some* chain.

都有很大概率摧毁 some chain 的所有 replicas。

the ring topologies are a compromise: you can't spread

ring topologies 是一种 compromise:你无法把

recovery load very widely, but a few random server failures

recovery load spread 得非常广,但少数 random server failures

are less likely to destroy all of any one chain's replicas.

不太可能摧毁某个 chain 的所有 replicas。

for their setup, speed of reconstruction seems to be more

对他们的 setup 来说,reconstruction speed 似乎比

important than simultaneous failures wiping out a chain.

simultaneous failures wiping out a chain 更重要。

however, they assume MTBF of a single server of 24 hours,

然而,他们假设单个 server 的 MTBF 是 24 hours,

which does mean fast repair is crucial when repair can

这确实意味着当 repair 可能需要数小时,fast repair 很关键,

take hours, but 24 hours seems unrealistically short.

但 24 hours 似乎 unrealistically short。

机制小结

1. Primary/backup 与 ROWA

Primary/backup 由 primary 给 operations 编号并向所有 backups 复制;write 必须得到所有 backups 的确认,因此每个 replica 都拥有 committed values。它可以承受 N-1 failures,但依赖 CFG 统一做 failover、lease 和 split-brain 防护,也会被最慢的 backup 拖慢。

2. Chain Replication 的 update/read path

update 从 head 开始,沿 chain 按顺序到达 tail;只有 tail 确认后才向 client 回复。read 直接由 tail 服务。这样 head 不必像 primary 一样向所有 backups fan-out,head 和 tail 也能分担工作;代价是 CFG、lease、reconfiguration 和沿途缓存 updates 的管理复杂度。

3. Failure recovery 与安全性

head failure 时 CFG 把第二个 server 设为 new head,各 server 只需与 successor 比对并补发最后几项 updates;tail failure 时倒数第二个 server 成为 new tail。由于 tail 只在所有前置 servers 都看到 update 后才看到它,tail 回复过的 update 在 tolerated failure 后不会消失。

4. Sharding 与 rndpar

大系统不能把全部 data 放进一个 replica group,应当把 data 切成远多于 servers 数量的 shards,让每个 server 参与许多 groups,并在 head、tail、middle 角色间分散负载。失败后为每个 shard 选择不同 replacement server,可以并行 repair;但随机 failures 同时命中同一 shard 的所有 replicas 的概率也会提高。

本篇验收

  • [x] 官方 l-cr.txt 已固定:357 行、316 个非空源行,SHA-256 与来源记录一致。
  • [x] 源文本的非空行按原顺序逐行保留,中文译文紧随对应英文源行。
  • [x] primary/backup、ROWA、Chain Replication、head/tail failure、CFG、lease、quorum、sharding 和 rndpar 全部覆盖。
  • [x] 所有 diagram 占位、ASCII chain/p/b 示意、sharding diagram、Figure/Section 引用和 take-away 均按原位置保留;源文件没有独立图片。
  • [x] primary、backup、head、tail、CFG、ROWA、Paxos、Raft、quorum、lease 和 shard 等术语保留原样。
  • [ ] Lecture 13 的中文译文仍建议进行一次人工术语审校;自动审计只验证源文覆盖与顺序,不证明翻译语义正确。
← 返回列表
← 上一篇 MIT 6.5840:Lecture 12 Spanner 下一篇 → MIT 6.5840:Lecture 14 FaRM and Optimistic Concurrency Control

评论 (0)

暂无评论,来留下第一条吧。
登录 或 注册 后才能发表评论