Transcript
Page 1: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely

Synchronized Physical Clocks

Jiaqing Du, Daniele Sciascia, Sameh ElniketyWilly Zwaenepoel, Fernando Pedone

EPFL, University of Lugano, Microsoft Research

Page 2: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Replicated State Machines (RSM)

• Strong consistency– Execute same commands in same order– Reach same state from same initial state

• Fault tolerance– Store data at multiple replicas– Failure masking / fast failover

2

Page 3: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Geo-Replication

Data Center

Data Center

Data CenterData Center

Data Center

• High latency among replicas• Messaging dominates replication latency

3

Page 4: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Leader-Based Protocols

• Order commands by a leader replica• Require extra ordering messages at follower

Leader

client request client reply

Ordering

Replication

High latency for geo replication

Ordering

4

Follower

Page 5: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Clock-RSM

• Orders commands using physical clocks• Overlaps ordering and replication

5

client request client reply

Ordering + Replication

Low latency for geo replication

Page 6: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Outline

• Clock-RSM• Comparison with Paxos• Evaluation• Conclusion

6

Page 7: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Outline

• Clock-RSM• Comparison with Paxos• Evaluation• Conclusion

7

Page 8: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Property and Assumption

• Provides linearizability• Tolerates failure of minority replicas• Assumptions– Asynchronous FIFO channels– Non-Byzantine faults– Loosely synchronized physical clocks

8

Page 9: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Protocol Overview

client request client reply

client request client reply

9

PrepOKcmd1.ts = Clock()

cmd2.ts = Clock()

Clock-RSM

cmd1cmd2

cmd1cmd2

cmd1cmd2

cmd1cmd2

cmd1cmd2

Page 10: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Major Message Steps

• Prep: Ask everyone to log a command• PrepOK: Tell everyone after logging a command

R0

R2

R1

client request

R3

R4

Prep

PrepOK

PrepOK

cmd1.ts = 24

PrepOK

PrepOK

cmd1 committed?

client request

cmd2.ts = 23

10

Page 11: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Commit Conditions

• A command is committed if– Replicated by a majority– All commands ordered before are committed

• Wait until three conditions holdC1: Majority replicationC2: Stable orderC3: Prefix replication

11

Page 12: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

C1: Majority Replication

• More than half replicas log cmd1

R0

R2

R1

client request

R3

R4

PrepOK

PrepOK

cmd1.ts = 24

Prep

Replicated by R0, R1, R2

1 RTT: between R0 and majority12

Page 13: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

C2: Stable Order

• Replica knows all commands ordered before cmd1– Receives a greater timestamp from every other replica

R0

R2

R1

client request

R3

R4

24

cmd1.ts = 24

2523

25

25

25

0.5 RTT: between R0 and farthest peer

cmd1 is stable at R0

13

Prep / PrepOK / ClockTime

Page 14: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

C3: Prefix Replication

• All commands ordered before cmd1 are replicated by a majority

14

R0

R2

R1

client request

R3

R4

cmd1.ts = 24

cmd2 is replicated by R1, R2, R3

cmd2.ts = 23

Prep

PrepOk

1 RTT: R4 to majority + majority to R0

client request

Prep

Prep

PrepOkPrepOk

Page 15: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Overlapping Steps

15

R0

R2

R1

client request

R3

R4

Latency of cmd1 : about 1 RTT to majority

client reply

Majority replication

Stable order

Prefix replication

PrepOK

PrepOK

Prep

Log(cmd1)

Log(cmd1)

24 2523

25

25

25

Prep

Prep

PrepOk

PrepOk

cmd1.ts = 24

Page 16: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Commit LatencyStep Latency

Majority replication 1 RTT (majority1) Stable order 0.5 RTT (farthest) Prefix replication 1 RTT (majority2)

Overall latency = MAX{ 1 RTT (majority1), 0.5 RTT (farthest), 1 RTT (majority2) }

16

If 0.5 RTT (farthest) < 1 RTT (majority), then overall latency ≈ 1 RTT (majority).

Page 17: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

R0

Topology Examples

Majority1

Farthest

R0

Majority1

Farthest

R3

R4

R2

R1

R4

R3

R2

R1

17

client request

client request

Page 18: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Outline

• Clock-RSM• Comparison with Paxos• Evaluation• Conclusion

18

Page 19: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Paxos 1: Multi-Paxos

• Single leader orders commands– Logical clock: 0, 1, 2, 3, ...

R0

Leader R2

R1

client request

Prep

CommitForward

client reply

PrepOKR3

R4

Latency at followers: 2 RTTs (leader & majority) 19

Page 20: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Paxos 2: Paxos-bcast

• Every replica broadcasts PrepOK– Trades off message complexity for latency

R0

Leader R2

R1

client request

Prep

Forward

client reply

PrepOK

R3

R4

Latency at followers: 1.5 RTTs (leader & majority)20

Page 21: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Clock-RSM vs. Paxos

• With realistic topologies, Clock-RSM has– Lower latency at Paxos follower replicas– Similar / slightly higher latency at Paxos leader

21

Protocol LatencyClock-RSM All replicas: 1 RTT (majority)

if 0.5 RTT (farthest) < 1 RTT (majority)Paxos-bcast Leader: 1 RTT (majority)

Follower: 1.5 RTTs (leader & majority)

Page 22: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Outline

• Clock-RSM• Comparison with Paxos• Evaluation• Conclusion

22

Page 23: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Experiment Setup

• Replicated key-value store• Deployed on Amazon EC2

California (CA)

Virginia (VA)

Ireland (IR)

Singapore (SG)

Japan (JP)

23

Page 24: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Latency (1/2)

• All replicas serve client requests

24

Page 25: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Overlapping vs. Separate Steps

CA VA

IR

SG

JP

25

CA VA (L)

IR

SG

JP

Clock-RSM latency: max of three

Paxos-bcast latency: sum of three

client request

client request

Page 26: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Latency (2/2)

• Paxos leader is changed to CA

26

Page 27: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Throughput

• Five replicas on a local cluster• Message batching is key

27

Page 28: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Also in the Paper

• A reconfiguration protocol• Comparison with Mencius• Latency analysis of protocols

28

Page 29: Clock-RSM: Low-Latency Inter-Datacenter State Machine Replication Using Loosely Synchronized Physical Clocks

Conclusion

• Clock-RSM: low latency geo-replication– Uses loosely synchronized physical clocks– Overlaps ordering and replication

• Leader-based protocols can incur high latency

29


Top Related