论文:Chain Replication for Supporting High Throughput and Availability
本篇整理 Chain Replication 论文。每一页保留原始 PDF 页面图;页面图是原文排版、Figure、模拟曲线、统计表、脚注和参考文献的原始副本,下面按原页顺序给出中文译文与必要术语说明。
论文:Chain Replication for Supporting High Throughput and Availability
相关文章:6.5840:Lecture 13 Chain Replication · 论文:The Google File System(GFS) · 论文:Raft 可理解的共识算法(扩展版) · 论文:Dynamo:Amazon’s Highly Available Key-value Store
TL;DR
- 解决的问题:为 fail-stop storage server cluster 提供高 throughput、高 availability 和 strong consistency,而不把所有 query/update 都压在一个 primary 上。
- 核心结构:replica 按线性顺序组成 chain;head 接收并串行化 update,tail 处理 query 并生成所有 reply,中间 replica 只转发 state change。
- 强一致性来源:query 和 update 最终都在 tail 串行处理;update 从 head 沿 FIFO link 传播到 tail,tail 看到的 state 是所有已完成 update 的前缀。
- 故障处理:head failure、tail failure 和 middle failure 采用不同 reconfiguration;middle 删除时用
Sentlist 补发可能丢失的 update,维护 update propagation invariant。 - 代价与边界:update latency 随 chain 串行传播,master/failure detector 和数据恢复决定 outage;replica placement 与 parallel recovery 直接决定大规模 availability。
名词解释
| 名词 | 含义 | 本文对应物 |
|---|---|---|
| Storage service | 对单个 object 提供 query 与 atomic update 的服务 | 位于 file system 与 database 之间的抽象 |
| Chain | 为一个 object/volume 线性排列的 replica 集合 | H → H+1 → ... → T |
| Head | chain 的第一个 replica,接收 update 并确定 update 顺序 | update entry point |
| Tail | chain 的最后一个 replica,处理 query 并生成 reply | 保存已完成 update 的 replica |
Hist | object 已执行 update 的 sequence | tail 上的 Hist_T 定义 object history |
Pending | 已被任意 replica 收到但尚未由 tail 处理的 request 集合 | client-view specification 的未完成部分 |
Sent | replica 已转发给 successor、但可能尚未被 tail 处理的 update list | middle failure recovery 的补发依据 |
| Fail-stop | server failure 后停止,不再做错误 state transition,且 failure 可被检测 | 论文的故障模型 |
| MTBU | Mean Time Between Unavailability | 评估 placement 和 recovery 的 availability 指标 |
目录
| 章节 | 内容 |
|---|---|
| 版本与来源 | OSDI ’04 版本、PDF 固定信息与翻译边界 |
| 原文页面与逐段翻译 | 14 个 PDF 页面按顺序保留并翻译 |
| 机制索引 | head/tail、failure recovery、primary/backup 与 placement |
| 本篇验收 | 页数、图片、Figure/Table 和覆盖范围 |
版本与来源
- 论文标题:Chain Replication for Supporting High Throughput and Availability。
- 作者与机构:Robbert van Renesse、Fred B. Schneider;FAST Search & Transfer ASA、Cornell University。
- 发表信息:6th Symposium on Operating Systems Design and Implementation(OSDI ’04),2004,pp. 91–104。
- 官方来源:USENIX 论文页面;USENIX PDF。
- 本地固定文件:
source/chain-replication.pdf。 - PDF 固定信息:14 页,每页 612×792 points;SHA-256:
af379b56d4098009ae1f2f19a7535754f2afd09af0077760d1b5a18a40328dc6。 - 附件处理:每页渲染为 1224×1584 PNG,存放于
assets/42 Chain Replication/,正文以600宽度嵌入。Figure 1–7、Table 1、space-time diagram、MTBU 曲线和 References 由原页图保留。 - 翻译边界:以原文段落、状态转移、协议步骤、Figure/Table caption、endnotes 和 References 为最小翻译单元;chain、head、tail、master、fail-stop、FIFO、DHT、MTBF、MTBU 等术语保留 English 或中英并列。
原文页面与逐段翻译
第 1 页:Abstract、Introduction 与 Storage Service 定位

标题与作者
Chain Replication:支持高吞吐量和高可用性
作者:Robbert van Renesse、Fred B. Schneider。
机构:FAST Search & Transfer ASA;Cornell University。
Abstract
Chain replication 是一种协调 fail-stop storage server cluster 的新方法。它面向 large-scale storage service,目标是在不牺牲 strong consistency guarantee 的前提下,提供 high throughput 和 high availability。
除了概述 chain replication protocol,本论文还通过 simulation experiment 探索 prototype implementation 的 performance characteristic,并讨论 throughput、availability 和多种 object-placement strategy(包括基于 distributed hash table routing 的方案)。
1 Introduction
Storage system 通常实现一些 operation,使 client 能够存储、获取和/或修改 data。File system 和 database system 可能是最熟知的例子。File system 的 operation(read、write)访问单个 file,并且是 idempotent 的;database system 的 operation(transaction)可能访问多个 object,并且具有 serializable 语义。
本文关注处于 file system 与 database system 之间的 storage system。具体来说,我们关注下面这种 storage system,后文称为 storage service:
- 存储性质未指定的 object;
- 支持 query operation,返回由单个 object 导出的 value;
- 支持 update operation,根据涉及该 object prior state 的、预先编程且可能 non-deterministic 的 computation,atomic 地改变单个 object 的 state。
因此,file-system write 是 storage-service update 的特例,而 storage-service update 又是 database transaction 的特例。
越来越多的 online vendor(如 Amazon.com)、search engine(如 Google 和 FAST),以及大量其他 information-intensive service,通过把 large-scale storage system 接入 network 来提供 value。当 database system 过于昂贵,而 file system 缺少足够丰富的 semantics 时,storage service 就是这类 application 的合适折中。
构建 large-scale storage service 的一个 challenge,是在 failure 以及随之而来的 storage-service configuration change(检测并替换 faulty component)下,仍保持 high availability 和 high throughput。
Consistency guarantee 也可能非常重要。即使它不是强制要求,若有 strong consistency guarantee,构建 front-end storage service 的 application 通常也会更简单。Strong consistency guarantee 断言:(i)对单个 object 的 query 和 update operation 按某个 sequential order 执行;(ii)update operation 的 effect 必然反映在随后 query operation 返回的结果中。
人们经常认为 strong consistency 与 high throughput、high availability 存在 tension。因此,系统设计者不愿牺牲 throughput 或 availability,通常拒绝提供 strong consistency guarantee。Google File System(GFS)体现了这种思路 [11]。实际上,large-scale storage service 中的 strong consistency guarantee 并不与 high throughput 和 high availability 不相容。
第 2 页:Storage Service Interface 与 Object State

本文研究的 chain replication 方法能够同时支持 high throughput、availability 和 strong consistency。论文组织如下:第 2 节定义 generic storage service 的 interface;第 3 节解释如何使用 chain replication 实现 query 和 update operation;chain replication 可以看作 primary/backup 方法的一个实例,因此第 4 节进行比较;第 5 节总结使用 chain-replication prototype 和 simulated network 分析 throughput、availability 的实验;部分 simulation 将 chain replication 与基于 DHT routing 的 storage system(如 CFS [7]、PAST [19])比较,另一些 simulation 展示 chain replication system 从 server failure 中恢复时的 surprising behavior;第 6 节将 chain replication 与 scalable storage、consistency/availability trade-off 和 replica placement 的其他工作比较;第 7 节给出结论,之后是 endnotes。
2 A Storage Service Interface
Storage service 的 client 发出 query 和 update operation 的 request。虽然可以保证每个到达 storage service 的 request 都一定执行,但 end-to-end argument [20] 表明这样做意义不大。更好的做法是,storage service 为每个收到并完成的 request 生成 reply,这样 lost request 和 lost reply 都可以被处理:如果等待 reply 超时,client 就重新发出 request。
query(objId, opts)的 reply 从 objectobjId的 value 导出;opts描述返回objId的哪些部分。objId的 value 不发生改变。update(objId, newVal, opts)的 reply 取决于opts;在一般情况下,它可以是一个 valueV,由某种预先编程、可能 non-deterministic 的方式根据objId当前 value 和/或newVal产生;随后V成为objId的新 value。
Query operation 是 idempotent 的,但 update operation 不一定是。如果 client 重新发出 non-idempotent update request,就必须采取措施确保该 update 尚未执行。例如,client 可以先发出 query,判断 object 当前 value 是否已经反映该 update。
对 client 来说,在到达 storage service 前丢失的 client request,与被 storage service 忽略的 request 无法区分。因此,当 storage server 出现 transient outage、在 outage 期间忽略 client request 时,client 不会暴露于一种新 failure mode。当然,合理的 client performance 可能取决于限制 transient outage 的频率和持续时间。
使用 chain replication 时,每次 transient outage 的持续时间都远短于移除 faulty host 或添加新 host 所需的时间。因此,在 failure、recovery 和其他 reconfiguration 期间,client request processing 仍能以极小 disruption 继续。大多数其他 replica-management protocol 要么 block 某些 operation,要么在 failure 和 reconfiguration 后牺牲 consistency guarantee。
我们通过描述 client 对 object state 以及对 query/update request 的 state transition,规定 storage service 的 functionality。Figure 1 用 pseudo-code 为 object objID 给出 specification。
Figure 1 用两个 variable 定义 objID state:已经执行的 update 的 sequence Hist_objID,以及尚未处理 request 的集合 Pending_objID。
Figure 1:Client 对 object 的 view
原图的 state 与 transition 如下:
State:
Hist_objID : update request sequence
Pending_objID : request set
Transitions:
T1: Client request r arrives:
Pending_objID := Pending_objID ∪ {r}
T2: Client request r ∈ Pending_objID ignored:
Pending_objID := Pending_objID − {r}
T3: Client request r ∈ Pending_objID processed:
Pending_objID := Pending_objID − {r}
if r = query(objId, opts) then
reply according opts based on Hist_objID
else if r = update(objId, newVal, opts) then
Hist_objID := Hist_objID · r
reply according opts based on Hist_objID
Figure 首先列出可能的 state transition。T1 断言到达的 client request 会加入 Pending_objID。T2 描述忽略某些 pending request;这个 transition 理论上不应频繁发生。T3 给出 request processing 的 high-level view:先从 Pending_objID 移除 request r;query 产生合适 reply;update 还会把 r append(记为 ·)到 Hist_objID。
第 3 页:Chain Replication Protocol 与 Invariant

Figure 2:A chain
原图展示一条 chain:update request 从 head 进入,沿 chain 向 tail 传播;query 发送到 tail;reply 从 tail 返回 client。
3 Chain Replication Protocol
假设 server 是 fail-stop 的:
- server failure 后停止,而不会继续进行错误的 state transition;
- server 的 halted state 可以被 environment 检测到。
如果一个 object 在 t 个 server 上复制,那么最多 t−1 个 server failure 而不损害 object availability。因此,object availability 提升为“所有承载该 object 的 server 都 failure”的概率;第 5.4 节的 simulation 探索典型 storage system 中的这一概率。下文假设同时最多有 t−1 个 replica server failure。
在 chain replication 中,复制某个 object objID 的 server 按线性顺序组成 chain(Figure 2)。Chain 中第一个 server 叫 head,最后一个叫 tail。Request processing 大致如下:
- Reply Generation:每个 request 的 reply 都由 tail 生成并发送。
- Query Processing:每个 query request 都发送到 chain 的 tail,在 tail 保存的
objIDreplica 上 atomic 地处理。 - Update Processing:每个 update request 都发送到 chain 的 head;head 使用自己的
objIDreplica atomic 地处理 request,然后通过连接相邻 server 的 reliable FIFO link 把 state change forward 给 chain 下一个元素;每个元素处理并继续 forward,直到 request 在 tail 被处理。
Strong consistency 因此成立:query 和 update request 都在单个 server(tail)上 serially 处理。
Query processing 只涉及一个 server,因此 query 是相对廉价的 operation。但处理 update 时,t 个 server 中前 t−1 个 server 完成的 computation 不参与生成 reply,可以认为是 redundant;这些 redundant server 增加的是 fault tolerance。
Chain replication 还避免了一部分 redundant computation:new value 由 head 计算一次,然后向下 forward,因此每个 replica 只需执行 write。Forward state change 还意味着 update 可以是 non-deterministic operation——non-deterministic choice 只在 head 做一次。
3.1 Protocol Details
Client 不直接读写 Figure 1 中的 Hist_objID 和 Pending_objID,因此我们可以用方便的方式实现它们。使用 chain replication 实现 Figure 1 specification 时:
Hist_objID定义为 chain tailT存储的Hist^T_objID;Pending_objID定义为 chain 中任意 server 收到、但尚未由 tail 处理的 client request 集合。
Chain replication 的 query-processing 和 update-processing protocol 要证明满足 Figure 1 specification,只需证明 chain 中每个 server 的 state transition,要么等价于 no-op,要么等价于允许的 T1、T2 或 T3。
在上述 Hist_objID 和 Pending_objID implementation 下(暂时假设没有 failure),唯一影响它们的 server transition 是:(i)chain 中 server 从 client 收到 request(影响 Pending_objID);(ii)tail 处理 client request(影响 Hist_objID)。其他 server transition 都等价于 no-op,因此只需证明这两个 transition 与 T1–T3 一致。
Client Request Arrives at Chain:Client 把 request 发送到 head(update)或 tail(query)。任一 server 收到 request r,都会把 r 加入“某 server 收到但尚未由 tail 处理的 request 集合”。因此它会把 r 加入 chain 定义的 Pending_objID,与 T1 一致。
Request Processed by Tail:执行 request 会把它从“任意 replica 收到但尚未由 tail 处理”的 request 集合中移除,因此从 chain 定义的 Pending_objID 中删除 request——这是 T3 的第一步。此外,tail T 使用 Hist^T_objID replica 处理 request;按照定义它实现了 Hist_objID,正好对应 T3 的剩余步骤。
第 4 页:Failure Model、Head/Tail Failure 与 Update Invariant

Coping with Server Failures
检测到 chain 中 server failure 后,chain 会被 reconfigure,以移除 failed server。为此使用一个称为 master 的 service,负责:
- 检测 server failure;
- 告知 chain 中每个 server,在删除 failed server 后得到的新 chain 中,它的新 predecessor 或 successor;
- 告知 client chain 的 head 和 tail 是谁。
下文假设 master 是一个永不 failure 的 single process。这个假设简化了说明,但不现实;我们的 chain-replication prototype 实际在多个 host 上 replication master,并使用 Paxos [16] 协调这些 replica,使它们整体表现得像一个不 failure 的 single process。
Master 区分三种情况:(i)head failure;(ii)tail failure;(iii)chain 中其他 server failure。各情况的处理依赖于 update 在 chain 中传播的如下 insight。
令 chain head 为 H,下一个 server 为 H+1,依此类推,tail 标记为 T。定义:
Hist^i_objID ⪯ Hist^j_objID
当 server i 上的 request sequence Hist^i_objID 是 server j 上 Hist^j_objID 的 prefix 时成立。由于 update 通过 reliable FIFO link 在 chain element 之间发送,每个 server 收到的 update sequence 都是其 successor 收到的 sequence 的 prefix。因此有:
Update Propagation Invariant:对于满足
i ≤ j(即i是j的 predecessor)的 server,有Hist^j_objID ⪯ Hist^i_objID。
Failure of the Head
Master 从 chain 中移除 H,并把 H 的 successor 设为新 head。如果最多 t−1 个 server faulty,这个 successor 必然存在。
从 chain 删除 H 是一次 transition,必须证明它是 no-op,或与 Figure 1 的 T1、T2、T3 一致。证明很容易:改变 chain 中 server 集合可能改变 Pending_objID;由于 Pending_objID 定义为 chain 中任意 server 收到但尚未由 tail 处理的 request 集合,删除 H 会移除那些由 H 收到、但尚未 forward 给 successor 的 request。把 request 从 Pending_objID 移除与 T2 一致,因此删除 H 与 Figure 1 specification 一致。
Failure of the Tail
Master 从 chain 中移除 T,并把 T 的 predecessor T− 设为新 tail。同样,最多 t−1 个 server replica faulty 时,这个 predecessor 必然存在。
该 chain change 同时改变 Pending_objID 和 Hist_objID,但与重复执行 T3 一致:由于 update propagation invariant(T− < T),有 Hist^T_objID ⪯ Hist^{T−}_objID。把 tail 从 T 改为 T−,可能使更多 request 被视为 tail 已完成,从定义上减少 Pending_objID。此外,按照 T3 要求,那些由 T− 完成但 T 尚未完成的 update 会出现在新的 Hist_objID 中。
第 5 页:Middle Failure、Sent List、Extend Chain

Failure of Other Servers
Chain 内部 server S failure 时,从 chain 中删除 S。Master 先告知 S 的 successor S+ 新 chain configuration,再告知 S 的 predecessor S−。但如果不采取措施确保 S failure 前收到的 update request 仍沿 chain forward,就可能破坏 update propagation invariant:这些 request 已出现在 S 的 predecessor 的 Hist^i_objID 中,却可能未到达 S+。
显然可以由 S− 完成 forward,但这需要 bookkeeping 和 coordination。
令 U 为 request 集合,<_U 是该集合上的 total order。如果 request sequence r 满足:(i)r 中所有 request 都属于 U;(ii)request 按 <_U ascending order 排列,则称 r 与 (U, <_U) consistent。对于与 (U, <_U) consistent 的 request sequence r 和 r',定义 r ⊕ r' 为 r 或 r' 中所有 request 组成的 sequence,使其与 (U, <_U) consistent(因此按 <_U 排列)。
Update propagation invariant 通过如下要求维护:replica S− 连接到新 successor S+ 时,第一件事就是通过两者之间的 FIFO link,把 Hist^{S−}_objID 中可能尚未到达 S+ 的 request 发送给 S+;只有发送完成后,S− 才能处理和 forward 它在承担新 chain position 后收到的 request。
为此,每个 server i 维护一个 Sent_i list,记录 i 已 forward 给 successor、但可能尚未由 tail 处理的 update request。规则很直接:server i forward update request r 给 successor 时,把 r append 到 Sent_i;tail 完成处理 r 后向 predecessor 发送 ack(r);server i 收到 ack(r) 后从 Sent_i 删除 r,并把 ack forward 给 predecessor。
Tail 收到的 request 必然已经被 chain 中所有 predecessor 收到,因此有:
In-process Requests Invariant:如果
i ≤ j,则Hist^i_objID = Hist^j_objID ⊕ Sent_i。
因此,只要 S− 收到 master 关于 S+ 成为新 successor 的 notification 后,先把 Sent_{S−} 中的 sequence forward 给 S+,就能维持 update propagation invariant。此外,Sent_{S−} 中已经出现在 Hist^{S+}_objID 的 prefix 不需要重复发送。
Figure 3:删除 internal replica 的 space-time diagram
原图展示 master、S−、S、S+ 和 chain 中其他 server 的时间关系:message 1 告知 S+ 新角色;message 2 由 S+ acknowledgment 并告知 master 它收到的最后 update sequence number sn;message 3 告知 S− 新角色及 sn;message 4 携带需要从 S− 补发给 S+ 的 suffix。
Extending a Chain
Failed server 会从 chain 中移除。但 chain 变短后能容忍的 failure 更少;如果 failure 太多,object availability 最终可能受损。解决办法是 chain 变短时加入新 server。
只要 server failure rate 不太高,且添加 server 不会耗时太长,就可以让 chain length 保持接近期望的 t 个 server,从而仍需额外 t−1 次 failure 才会损害 object availability。
理论上,新 server 可以加到 chain 的任意位置;实践中把新 server T+ 添加到 chain 最末端最简单。对于 tail T+,Sent_{T+} 始终为空 list,因此初始化很容易。剩下的问题是初始化 Hist^{T+}_objID,使其满足 update propagation invariant。
第 6 页:Extend Chain、Primary/Backup 与 Failure Recovery

初始化 Hist^{T+}_objID 的办法是让当前 tail T 把自己保存的 object replica Hist^T_objID forward 给 T+。即使 object 很大、forward 需要一些时间,这个过程也可以与 T 处理 client query、以及处理来自 predecessor 的 update 并发进行,只要每个 update 都同时 append 到 Sent_T。
在 forward 期间始终有 Hist^{T+}_objID ⪯ Hist^T_objID,因此 update propagation invariant 保持成立。当满足
Hist^T_objID = Hist^{T+}_objID ⊕ Sent_T
时,in-process requests invariant 建立,T+ 可以开始作为 chain tail:
- 通知
T它不再是 tail。此后T可以丢弃 client 发来的 query,但更合理的 policy 是把这些 query forward 给新 tailT+。 - 按 sequence 将
Sent_T中的 request 发送给T+。 - 通知 master
T+是新 tail。 - 通知 client 应把 query request 发给
T+。
4 Primary/Backup Protocols
Chain replication 是 primary/backup 方法 [3] 的一种形式,而 primary/backup 又是 state-machine approach [22] 的一个实例。
在 primary/backup 方法中,一个被指定为 primary 的 server:
- 对 client request 排序,从而保证 strong consistency;
- 按顺序把 client request 或产生的 update 分发给其他 server(称为 backup);
- 等待所有 non-faulty backup 的 acknowledgment;
- 收到 acknowledgment 后再向 client 发送 reply。
如果 primary failure,则把某个 backup 提升为 primary。
在 chain replication 中,primary 的 request-sequencing role 由两个 replica 共享:head 对 update request 排序,tail 通过交错 query request 扩展这个顺序。共享责任不仅 partition 了 sequencing task,也让 query request 具有更低 latency 和 overhead:query 只涉及 tail 一个 server,而且不会被 chain 其他位置的 activity 延迟。
相比之下,primary/backup 方法中,primary 在回复 query 前必须等待 backup 对之前 update 的 acknowledgment。
Chain replication 和 primary/backup 都必须把 update request 分发给复制 object 的所有 server,否则 replica 会 diverge。Chain replication 串行执行 dissemination,因此 latency 高于 primary/backup 的 parallel dissemination。Parallel dissemination 的 reply generation time 与任一 non-faulty backup 的最大 latency 成正比;serial dissemination 则与这些 latency 之和成正比。
第 5 节的 simulation 量化这些 performance difference,还比较 query 发给任意 server 的 chain/primary-backup variant(代价是可能牺牲 strong consistency)。
不需要 simulation 也能理解两种 approach 如何处理 server failure。核心关注点是:service 因 failure reconfigure 时,client 经历 transient outage 的持续时间;第二个关注点是 failure 引入的 latency。
检测 server failure 的 delay 是主要 cost,而且 chain replication 与 primary/backup 相同。下面在假设 failure 已检测、message delay 是 protocol latency 主要来源的条件下,分析两种 approach 的 recovery cost。
Chain replication 有三种情况:
- Head Failure:Query processing 不间断。Master 向新 head 及其 successor broadcast message,然后 broadcast 给所有 client 新 head;update processing 不可用两个 message-delivery delay。
- Middle Server Failure:Query processing 不间断。Update processing 可能 delay,但 update request 不会丢失;只要收到 request 的 chain prefix 中仍有某个 server 运行,就不会产生 transient outage。Middle failure 可能导致 update processing delay;Figure 3 protocol 涉及四个 message-delivery delay。
- Tail Failure:Query 和 update processing 都不可用两个 message-delivery delay;master 向 new tail 发送 message,再 broadcast 给所有 client 新 tail。
第 7 页:Primary/Backup Failure 对比与 Simulation Setup

Primary/backup 有两种情况,query 和 update 对每种情况的影响相同:
- Primary Failure:经历五个 message delay 的 transient outage。Master 检测 failure 后,broadcast 给所有 backup,要求它们报告已处理的 update 数量,并暂停处理 request。每个 backup 回复 master。Master 再把新 primary identity broadcast 给所有 backup;处理 update 最大数量的 backup 成为 new primary,并把其他 backup 缺少的 update forward 给它们。最后 master broadcast message,通知所有 client 新 primary。
- Backup Failure:如果没有 update request 处于 in-progress,query processing 不间断。如果 update 正在进行,会经历最多一个 message delay 的 transient outage:master 向 primary 发送 message,说明 faulty backup 不会返回 acknowledgment,之后不应再向该 backup 发送 request。
因此,chain replication 的最坏 outage(tail failure)永远不如 primary/backup 的最坏 outage(primary failure)长;chain replication 的最好情况(middle failure)也比 primary/backup 的最好情况(backup failure)短。但如果 transient outage duration 是 storage service design 的主要考量,选择 chain replication 还是 primary/backup,就需要了解 request type 的组成以及不同 server failure 的概率。
5 Simulation Experiments
为了更好理解 chain replication 的 throughput 和 availability,我们在 simulated network 中执行一系列 experiment。实验包含 chain replication prototype,以及若干 alternative 的 prototype implementation。
由于我们主要关注 chain replication 内在 processing 和 communication 引起的 delay,模拟 network 具有 infinite bandwidth,但每条 message 的 latency 为 1ms。
5.1 Single Chain, No Failures
首先考虑只有一条 chain、没有 failure、replication factor t 为 2、3、10 的简单情况。我们比较四种 replication-management alternative 的 throughput:
- chain:Chain replication。
- p/b:Primary/backup。
- weak-chain:修改后的 chain replication,使 query request 发送给任意随机 server。
- weak-p/b:修改后的 primary/backup,使 query request 发送给任意随机 server。
注意,weak-chain 和 weak-p/b 不提供 chain 和 p/b 提供的 strong consistency guarantee。
我们把 server 上的 query latency 固定为 5ms,把 update latency 固定为 50ms。这些数字来自 web-search index query/update 的实际值。假设每次 update 都包含涉及 disk read 的 initial processing,并且 forward object-difference 比在每个 replica 上重新执行 update processing 更便宜;预计 replica 处理 object-difference message 需要 20ms(相当于两次 disk access 和适度 computation)。
例如,三台 server 的 chain 中,一次 update 的总 latency 是 94ms:client 到 head 的 message 为 1ms;head 上 update latency 为 50ms;其余两台 server 各处理 object-difference message 20ms;此外还有三次 forward latency,各 1ms。但 query latency 只有 7ms。
Figure 4 按 update request 的百分比,绘制 t = 2、t = 3、t = 10 时 total throughput。实验有 25 个 client,每个 client 的 query/update mix 符合给定百分比。每个 client 一次只提交一个 request,并且只等待上一个 request 的 reply,不额外 delay;所有 client 最多同时有 25 个 outstanding request。
第 8 页:单链模拟结果与多链实验设置

Figure 4:不同 replication-management alternative 的 request throughput
原图有三个子图:(a)t = 2;(b)t = 3;(c)t = 10。横轴是 percentage updates,纵轴是 total throughput;曲线为 weak、chain、p/b。由于 weak-chain 和 weak-p/b 的结果几乎完全相同,Figure 4 只画一条名为 weak 的曲线。
观察到,对于所有 update percentage 和每个考察的 replication factor,chain replication 的 performance 都不低于 primary/backup。这符合预期:head 和 tail 在 chain replication 中共享了 primary/backup 中由 primary 单独处理的 load。
Weak variant 的曲线可能令人意外:当 update request 超过 15% 后,weak variant 的表现反而差于带 strong consistency 的 chain replication。原因有两个:
- 对 query-heavy load,weak-chain 和 weak-p/b 把 query load 分布到所有 server,因此胜过普通 chain;replication factor 越大,这个优势越明显。
- update percentage 增大后,普通 chain replication 胜过 weak variant,因为所有 update 都在 head 执行。具体来说,在普通 chain 中:(i)query 不会在 head 等待耗时的 update 完成;(ii)如果 query 不在 head 处理,head 有更多 capacity 处理 update。
由于 weak-chain 和 weak-p/b 没有 strong consistency guarantee,似乎只有很少的场景会偏好这两种 replication-management scheme。
最后注意,只要有足够 concurrent request 能够让 request pipeline 工作,chain replication 和 primary/backup 的 throughput 都不受 replication factor 影响。
5.2 Multiple Chains, No Failures
如果每个 object 由独立 chain 管理,且 object 很大,那么添加 replica 可能由于向新 replica 传输 object state 而有相当 delay。如果 object 很小,large storage service 就会涉及大量 object;此时每个 processor 很可能托管多个 chain 的 server,multiplex processor 和 communication channel 的 cost 可能变得过高。此外,一个 processor failure 会同时影响多条 chain。
一组 object 总可以分组到一个 volume 中;volume 本身可以作为 chain replication 意义上的 object,因此 designer 对 object size 有很大选择空间。
下一组实验假设:
- volume 数量固定;
- hash function 把每个 object 映射到一个 volume,进而映射到唯一 chain;
- 每条 chain 的 server 从实现 storage service 的 processor 中选择并托管。
第 9 页:多 Chain Throughput 与 Failure 实验参数

Client 向 dispatcher 发送 request。Dispatcher:(i)计算 hash,确定负责存储目标 object 的 volume 和 chain;(ii)把 request forward 给对应 chain。Master 向 dispatcher 发送每个 volume 的 configuration information,因此不必直接与 client 通信。Dispatcher 会为 update 和 query 各增加 1ms delay,但不影响 throughput。Chain 生成的 reply 直接发送给 client,不经过 dispatcher。
实验有 25 个 client,每个 client 在各条 chain 上均匀随机提交 query 和 update。Client 尽可能快地发送 request,但每个 client 同时只能有一个 outstanding request。
为便于与 GFS experiment [11] 比较,我们假设 5000 个 volume,每个 volume 复制三次,并改变 server 数量。我们发现 chain、p/b、weak-chain 和 weak-p/b 几乎没有差别,因此 Figure 5 只展示一种方案——chain replication——在不同 update percentage 下、随 server 数量变化的 average request throughput per client。
Figure 5:不同 update percentage 下,平均 request throughput 与 server 数量的关系
原图横轴为 #servers,纵轴为 average throughput;曲线包含 queries only、5%、10%、25%、50% updates 和 updates only。
5.3 Effects of Failures on Throughput
在 chain replication 中,每个 server failure 都启动三阶段过程:
- Master 检测到 server failure 前先经过一段时间(实验中保守假设为 10 秒)。
- 从 chain 中删除 faulty server。
- Master 最终向该 chain 加入新 server,并启动 data recovery;recovery time 与(i)faulty server 上存储的 data 数量、(ii)可用 network bandwidth 成正比。
Failure detection 或从 chain 删除 faulty server 的 delay,会增加 request-processing latency,也会增加 transient outage duration。本节实验探究这些影响。
我们假设 storage service 具有 Table 1 参数,这些值受 GFS [11] 报告启发。Network bandwidth 假设基于在 100Mbit/s network 中最多预留一半 bandwidth 做 data recovery;此时复制一台 server 上存储的 150GB data 需要 6 小时 40 分钟。
为测量 failure 对 storage service 的影响,我们施加一个 load。Load 的精确细节不太重要。实验使用 11 个 client:每个 client 不断随机选择 object、执行 operation、等待 reply;如果 3 秒没有收到 reply,watchdog timer 让 client 开始下一轮。10 个 client 只提交 query,另一个 client 只提交 update。
Table 1:Simulated Storage Service Characteristics
| Parameter | Value |
|---|---|
Number of servers (N) | 24 |
| Number of volumes | 5000 |
Chain length (t) | 3 |
| Data stored per server | 150 Gigabytes |
| Maximum network bandwidth for data recovery to/from any server | 6.25 Megabytes/sec |
| Server reboot time after failure | 10 minutes |
第 10 页:Failure Throughput、Recovery 与 Critical Data

每个实验运行 2 个 simulated hour。实验开始 30 分钟时,模拟一个或两个 server failure(与 GFS experiment 相同)。Master 检测 failure,并从涉及该 server 的所有 chain 中删除它。对于因 failure 变短的每条 chain,master 选择一个新 server 加入,并启动向该 server 的 data recovery。
Figure 6:00:30 发生一到两个 failure 时的 query/update throughput
Figure 6(a) 展示一个 server F failure 时,aggregate query 和 update throughput 随时间变化。注意 simulated failure 在 30 分钟发生时 throughput 突然下降。由于 x-axis resolution 较粗,看不到 failure 后大约 10 秒 throughput 实际为零:master 需要稍多于 10 秒检测 failure,并从所有 chain 中删除 failed server。
从所有 chain 删除 failed server 后,processing 可以继续,但速率略低:运行中的 server 变少,同样的 request load 必须由更少 server 共享;同时 data recovery 正在消耗各 server 的 resource。Graph 中较低的 curve 反映了这一点。
10 分钟后,failed server F 恢复运行,成为 data recovery 的候选目标。每当某个 volume 在 F 上完成 data recovery,query throughput 就改善一次,因为此时 F 作为另一条 chain 的 tail,承担了越来越多 query load。
可能会预期:全部 data recovery 完成后,query throughput 应恢复到实验开始的水平。但实际情况更复杂,因为 volume 不再均匀分布在 server 上。具体来说,server F 此时参与的 chain 少于其他 server,但它参与的每条 chain 都是 tail。因此,load 不再均衡,aggregate query throughput 低于初始值。
Update throughput 在 server failure 时下降到 0;master 从所有 chain 删除 failed server 后,throughput 反而比初始值更好。这是因为 failure 使部分 chain length 变成 2 而不是 3,减少了执行 update 所需的 work。
GFS experiment [11] 也考虑两个 server failure,因此 Figure 6(b) 展示 chain replication protocol 在该情况下的结果。Recovery 仍然平滑,只是需要更多时间。
5.4 Large Scale Replication of Critical Data
随着 server 数量增加,server failure 的 aggregate rate 也应增加。如果 failure 太多,一个 volume 可能变为 unavailable。这个概率取决于 volume 在 server 上的 placement,特别取决于 data recovery 能够并行到什么程度。
第 11 页:Replica Placement、Parallel Recovery 与 MTBU

我们研究三种 volume placement strategy:
- ring:volume 的 replica 放在 ring 上 consecutive server,位置由 volume identifier 的 consistent hash 决定。这是 CFS [7] 和 PAST [19] 使用的 strategy。可并行的 data recovery 数量受 chain length
t限制。 - rndpar:volume replica 随机放置在 server 上,本质上是 GFS 使用的 strategy。注意,如果 server 足够多,可并行的 data recovery 数量没有上限。
- rndseq:volume replica 也随机放置,但可并行 recovery 数量受
t限制,与 ring 一样。已知 system 没有使用该 strategy,但它是量化 placement 和 parallel recovery 影响的有用 benchmark。
为了理解 parallel data recovery 的优势,考虑 server F failure;它参与 chain C1, C2, ..., Cn。对每条 chain Ci,data recovery 需要一个获取 volume data 的 source,以及一个将成为 Ci 新 element 的 host。如果 processor 足够多,且 volume placement 没有限制,很容易确保所有新 element 互不相同。随机 placement 很可能也使 source 互不相同。
如果 source 和 new element 都彼此 disjoint,那么 C1, C2, ..., Cn 的 data recovery 可以并行进行。C1, C2, ..., Cn 的 recovery interval 更短,就意味着 vulnerability window 更短;在这个 window 内,少量 concurrent failure 可能让某个 volume unavailable。
我们希望根据 server 数量和 placement strategy,量化任意 object 变为 unavailable 的 mean time between unavailability(MTBU)。假设每台 server 的 failure 服从 exponential distribution,MTBF(Mean Time Between Failures)为 24 小时。
随着 storage system 中 server 数量增加,volume 数量也增加,否则添加 server 就没有意义。实验中 volume 数量定义为 initial server 数量的 100 倍,每台 server 在 time 0 存储 100 个 volume。
假设把一台 server 的全部 data 复制到另一台 server 需要四小时,对应在 100Mbit/s network 上复制 100GB data,并限制只能使用一半 bandwidth 做 recovery。和 GFS experiment 一样,network 上最大 parallel data recovery 数量限制为 server 数量的 40%;最小 transfer time 设为 10 秒(复制单个 GFS object 64KB 所需时间)。
Figure 7:三种 placement strategy 下 MTBU 与 server 数量、replication factor 的关系
原图包含:(a)ring:基于 DHT 的 placement,允许最大 parallel recovery;(b)rndseq:random placement,但把 parallel recovery 限制到 DHT 可达到的程度;(c)rndpar:random placement,允许最大 parallel recovery。曲线按 t = 1, 2, 3, 4 给出,error bar 为 99% confidence interval。
Figure 7(a) 显示,ring strategy 的 MTBU 随 server 数量大致呈 Zipfian distribution。为了在增加 server 数量时维持特定 MTBU,必须增加 chain length t;从 graph 看,chain length 似乎需要按 server 数量的 logarithm 增加。
Figure 7(b) 展示 rndseq 的 MTBU。对 t > 1,rndseq 的 MTBU 低于 ring。与 ring 相比,random placement 较差,因为存在更多组 t 个共同存储 chain 副本的 server,因此 chain 因 failure 丢失的概率更高。
但 random placement 在 server 足够多时提供了更多 parallel recovery opportunity。Figure 7(c) 展示 rndpar:server 少时,rndpar 与 rndseq 相同;随着 server 数量增加,parallel recovery opportunity 增多,MTBU 改善,最终 rndpar 胜过 rndseq,更重要的是胜过 ring。
第 12 页:Availability 结论与 Related Work

因此,为了维持特定 MTBU,server 数量增加时必须增长 chain length t。从 graph 看,chain length 似乎需要随 server 数量的 logarithm 增长。
6 Related Work
Scalability
Chain replication 是 Jiménez-Peris 和 Patiño-Martínez [14] 所称 ROWAA(read one, write all available)方法的一个例子。他们报告 ROWAA 方法相比 quorum technique 具有更好的 availability scaling,并认为 ROWAA availability 会随 replica 数量 exponential 提升。他们还认为 non-ROWAA replication 必然更差。由于 ROWAA 的 throughput 也优于已知最佳 quorum system(几乎纯 write application 除外)[14],在大多数真实场景中,ROWAA 似乎是更好的 replication 选择。
许多 file service 为 performance 和 scalability 牺牲 consistency,例如 Bayou [17]、Ficus [13]、Coda [15] 和 Sprite [5]。这些 system 通常允许 network partition 期间继续运行,并提供半自动修复 inconsistency 的 tool。我们的 chain replication 不支持 partitioned operation 的 graceful handling,而是用这一点换取 high performance、scalability 和 strong consistency 三者同时成立。
Large-scale peer-to-peer reliable file system 是相对较新的研究方向,例如 OceanStore [6]、FARSITE [2] 和 PAST [19]。其中只有 OceanStore 提供 strong(实际上是 transactional)consistency guarantee。
Google File System(GFS)[11] 是一个 large-scale cluster-based reliable file system,面向与 chain replication 发明动机相近的 application。但在 GFS 中,并发 overwrite 不会被 serialise,read operation 也不会与 write operation synchronize。因此,不同 replica 可能处于不同 state,read operation 返回的 content 甚至可能在 GFS 中“凭空消失”。这种 weak semantic 给使用 GFS 的 application programmer 带来负担。
Availability versus Consistency
Yu 和 Vahdat [25] 研究 consistency 与 availability 的 trade-off。他们认为,即使在 relaxed consistency model 中,如果要长期维持 availability,也应尽可能接近 strong consistency。另一方面,Gray 等人 [12] 认为 strong-consistency system 在 scale-up 时会表现不稳定,并提出 tentative-update transaction 规避这些 scalability problem。
Amza 等人 [4] 提出一个针对 replication 优化的 one-copy serializable transaction protocol。和 chain replication 一样,update 发送给所有 replica,而 query 只由已知保存全部 completed update 的 replica 处理(在 chain replication 中,这个 replica 是 tail)。该 protocol 的 performance 与提供 weak consistency 的 replication protocol 一样好,并能随 replica 数量良好扩展,但没有分析 failure 场景下的 behavior。
Replica Placement
之前关于 replica placement 的工作主要关注 high throughput 和/或 low latency,而不是 high availability。Acharya 和 Zdonik [1] 建议根据 future access 的预测放置 replica,这些预测基于 past access。Mariposa project [23] 使用一组 rule,让 user 指定 replica 创建位置、是否把 data 移到 query 所在地或 query 移到 data 所在地、cache data 的位置等。它提供 transactional consistency,但不考虑 availability。
Wolfson 等人研究 database replica placement strategy,以优化 performance [24]。OceanStore project [10, 6] 也研究 replica placement,但从 CDN(例如 Akamai)的角度出发,在满足 quality-of-service guarantee 的同时创建尽可能少的 replica。还有大量工作(例如 [18])研究 web page replica placement,目标都是降低 latency 和 network load。
第 13 页:Replica Placement 补充、Concluding Remarks 与 Endnotes

Douceur 和 Wattenhofer 研究如何在 FARSITE [2] 中最大化 file 的 worst-case availability,同时把 storage load 均匀分布到所有 server [8, 9]。假设 server 具有不同 availability。如果交换 machine 之间的 file 能提高 file availability,他们提出的 algorithm 就反复执行 swap。结果是针对简单场景的理论结果;这些 algorithm 在 realistic storage system 中的效果尚不明确。
7 Concluding Remarks
Chain replication 为 query 和 update request 提供 high throughput,为 data object 提供 high availability,并提供 strong consistency guarantee。这部分得益于:使用 chain replication 构建的 storage service 可以发生 transient outage,但 client 无法把这种 outage 与 lost message 区分开。因此,chain replication 引入的 transient outage 不会让 client 暴露于新的 failure mode;chain replication 在隐藏和不隐藏哪些 failure 之间取得了有趣平衡。
使用 chain replication 时,data object 的 high availability 来自仔细选择 volume replica 在 server 上的 placement strategy。我们的实验表明,使用 DHT-based placement,availability 不太可能随 server 数量增加而 scale;但实验也表明,如果 random placement 与 parallel data recovery 一起使用,availability 可以随 server 数量 scale,后者正是 GFS 引入的方式。
当前 prototype 主要面向相对 homogeneous 的 LAN cluster。如果把它部署到 heterogeneous wide-area environment,uniform random placement of volume replica 就不再合理。Replica placement 必须依赖 access pattern、network proximity 和观察到的 host reliability。重新排列 chain element 的 protocol 可能变得很重要,以便控制 load imbalance。
我们的 prototype chain-replication implementation 包含 1500 行 Java code,另有 2300 行 Java code 实现 Paxos library。Chain replication protocol 被组织为一个 library,向 storage service(或其他 application)发出 upcall。本文实验使用 simulated network 上的 “null service”。但 library 也运行在 Java socket library 之上,因此可用于支持各种 storage-service-like application。
Acknowledgements
感谢 FAST 的同事 Håkon Brugård、Kjetil Jacobsen 和 Knut Omang,他们最初让我们关注这个问题。感谢 Mark Linderman 和 Sarah Chung 参与讨论,帮助修改本文早期版本。也感谢 OSDI reviewer 和 shepherd Margo Seltzer 的 comments。感谢挪威 Research Council 对 FAST ASA 的 grant;该 grant 在文中致谢。Van Renesse 和 Schneider 的部分工作由 AFOSR grant F49620–03–1–0156 与 DARPA/AFRL-IFGA grant F30602-99-1-0532 支持;但本文观点和结论不应被解释为美国政府的官方政策或 endorsement。
Notes
- 当
V = newVal时,update 的语义就是 file-system write;当V = F(newVal, objID)时,相当于支持 object 上的 atomic read-modify-write。虽然这种语义很强,但还不足以支持 transaction;transaction 能够不可分割地 query 和/或 update 多个 object。 - 真实 implementation 可能存储 object 当前 value,而不是产生该 value 的 update sequence。本文使用 update sequence 表示,是因为这样更容易论证 strong consistency guarantee 成立。
- 如果
Hist_objID存储 object 当前 value 而非完整 history,那么“Hist_objID · r”应理解为把 update 应用到 object。 - 如果
Hist^i_objID是 current state 而不是 update sequence,那么⪯定义为“prior value”关系,而不是“prefix of”关系。 - 实际上,[11] 没有讨论 placement strategy。GFS 执行某种 load balancing,使 server 上的 load 大致均匀;在 simulation 中,我们认为 random placement 是该 strategy 的良好近似。
- 这里选择了不现实的短 MTBF,以便运行长时间 simulation。
第 14 页:References

下面保留原文 references 的编号和主要书目信息;完整排版、断行和会议格式由本页原图保留。
- S. Acharya and S. B. Zdonik. An efficient scheme for dynamic data replication. Technical Report CS-93-43, Brown University, 1993。
- A. Adya et al. FARSITE: Federated, Available, and Reliable Storage for an Incompletely Trusted Environment. OSDI, 2002。
- P. A. Alsberg and J. D. Day. A principle for resilient sharing of distributed resources. 2nd International Conference on Software Engineering, 1976。
- C. Amza, A. L. Cox, and W. Zwaenepoel. Distributed Versioning: Consistent replication for scaling back-end databases of dynamic content web sites. Middleware ’03, 2003。
- M. G. Baker and J. K. Ousterhout. Availability in the Sprite distributed file system. Operating Systems Review 25(2), 1991。
- Y. Chen, R. H. Katz, and J. Kubiatowicz. Dynamic replica placement for scalable content delivery. 1st International Workshop on Peer-To-Peer Systems, 2002。
- F. Dabek, M. F. Kaashoek, D. Karger, R. Morris, and I. Stoica. Wide-area cooperative storage with CFS. SOSP, 2001。
- J. R. Douceur and R. P. Wattenhofer. Competitive hill-climbing strategies for replica placement in a distributed file system. DISC, 2001。
- J. R. Douceur and R. P. Wattenhofer. Optimizing file availability in a secure serverless distributed file system. SRDS, 2001。
- D. Geels and J. Kubiatowicz. Replica management should be a game. 10th European SIGOPS Workshop, 2002。
- S. Ghemawat, H. Gobioff, and S.-T. Leung. The Google file system. SOSP, 2003。
- J. Gray, P. Helland, P. O’Neil, and D. Shasha. The dangers of replication and a solution. SIGMOD, 1996。
- J. S. Heidemann and G. Popek. File system development with stackable layers. ACM TOCS 12(1), 1994。
- R. Jiménez-Peris and M. Patiño-Martínez. Are quorums an alternative for data replication? ACM TODS 28(3), 2003。
- J. Kistler and M. Satyanarayanan. Disconnected operation in the Coda file system. ACM TOCS 10(1), 1992。
- L. Lamport. The part-time parliament. ACM TOCS 16(2), 1998。
- K. Petersen et al. Flexible update propagation for weakly consistent replication. SOSP, 1997。
- L. Qiu, V. N. Padmanabhan, and G. M. Voelker. On the placement of web server replicas. INFOCOM, 2001。
- A. Rowstron and P. Druschel. Storage management and caching in PAST, a large scale, persistent peer-to-peer storage utility. SOSP, 2001。
- J. Saltzer, D. Reed, and D. Clark. End-to-end arguments in system design. ACM TOCS 2(4), 1984。
- F. B. Schneider. Byzantine generals in action: Implementing fail-stop processors. ACM TOCS 2(2), 1984。
- F. B. Schneider. Implementing fault-tolerant services using the state machine approach: A tutorial. ACM Computing Surveys 22(4), 1990。
- M. Stonebraker et al. Mariposa: A new architecture for distributed data. ICDE, 1994。
- O. Wolfson, S. Jajodia, and Y. Huang. An adaptive data replication algorithm. ACM TOCS 22(2), 1997。
- H. Yu and A. Vahdat. The cost and limits of availability for replicated services. SOSP, 2001。
机制索引
| 机制 | 本文位置 | 关键判断 |
|---|---|---|
| Storage service interface | 第 1–2 页 | 以单 object query/update 介于 file system 与 database 之间 |
| Client-view specification | 第 2 页 | Hist 表示已执行 update,Pending 表示未由 tail 处理的 request |
| Head/tail split | 第 3 页 | head 排序 update,tail 串行处理 query 并生成 reply |
| Update propagation invariant | 第 4 页 | predecessor 的 history 是 successor history 的 extension,保证 tail state 有序 |
| Middle failure recovery | 第 5 页 | Sent list + suffix replay 避免内部 replica 删除导致 update 丢失 |
| Chain extension | 第 5–6 页 | 从当前 tail 向新 tail copy state,再补发 in-flight update |
| Primary/backup comparison | 第 6–7 页 | chain 将 sequencing 分给 head/tail,query 不必等待 backup ack |
| Task throughput | 第 7–9 页 | chain 在强一致场景下可与或优于 primary/backup |
| Failure outage | 第 9–10 页 | failure detection、删除 replica 和 recovery 分别贡献 latency/outage |
| Replica placement | 第 11–12 页 | ring、rndseq、rndpar 对并行恢复和 MTBU 影响不同 |
| Strong consistency trade-off | 第 12–13 页 | 不支持 partitioned operation 的 graceful handling,换取强一致性 |
本篇验收
- 页面覆盖:14/14 个 PDF 页面均已保留原图并按原顺序翻译。
- 图表覆盖:保留 Figure 1–7、Table 1、chain diagram、space-time deletion diagram、throughput/MTBU 曲线、Notes 和 25 条 References。
- 机制覆盖:storage service interface、client-view state machine、head/tail protocol、failure model、update propagation invariant、head/tail/middle failure、Sent list、chain extension、primary/backup 对比、single/multiple chain simulation、failure throughput、replica placement、MTBU、related work、conclusions 和 endnotes 均已覆盖。
- 翻译策略:遵循逐页、逐段顺序;chain replication 生态中的约定俗成术语保留 English,不强行直译;原文页面图作为版式与图片位置的最终依据。
参考资料
评论 (0)