Sequence Consensus and MultiPaxos Seif Haridi Niklas Ekstrm

  • Slides: 13
Download presentation
Sequence Consensus and Multi-Paxos Seif Haridi, Niklas Ekström KTH Royal Institute of Technology haridi(at)kth.

Sequence Consensus and Multi-Paxos Seif Haridi, Niklas Ekström KTH Royal Institute of Technology haridi(at)kth. se, neks(at)kth. se

Motivation n We wish to implement a replicated state machine (RSM) or total order

Motivation n We wish to implement a replicated state machine (RSM) or total order broadcast Processes need to agree on the sequence of commands (or messages) to execute The standard approach is to use Paxos for single-value consensus as a starting point 21 October 2021 N. Ekström and S. Haridi 2

Consensus Properties n Validity q n Uniform Agreement q n No two processes decide

Consensus Properties n Validity q n Uniform Agreement q n No two processes decide different values Integrity q n Only proposed values may be decided Each process can decide at most one value Termination q Every correct process eventually decides a value 21 October 2021 N. Ekström and S. Haridi 3

First Trial ! n Each process q q n The approach has a serious

First Trial ! n Each process q q n The approach has a serious drawback: q n Waits until all commands are known Orders the commands into a sequence Proposes its sequence Execute commands once a sequence is decided Cannot execute until all commands are known We would like to agree on a growing sequence of commands 21 October 2021 N. Ekström and S. Haridi 4

Second Trial ! n n Consensus is agreement about a single value Let us

Second Trial ! n n Consensus is agreement about a single value Let us use Paxos Organize the algorithm in rounds At round i q q q A proposer selects a command C not decided at previous rounds 1. . i-1 Propose C for slot i Wait until Decide Cd Add Cd to the set of decided commands Move to the next round 21 October 2021 N. Ekström and S. Haridi 5

Problems with Second Trial ! n At round i q q n A proposer

Problems with Second Trial ! n At round i q q n A proposer selects a command C not decided at previous rounds 1. . i-1 Propose C and wait for Decide Cd Add Cd to the set decided commands Move to the next round This algorithm is sequential! q q prepare promise accepted decide In order to select a command at round i proposers have to agree on the sequence of commands C 1 … Ci-1 Not easy to pipeline proposals n Same proposal C might end decided in different slots 21 October 2021 N. Ekström and S. Haridi 6

Problems with Second Trial ! n Not easy to pipeline proposals q p 1

Problems with Second Trial ! n Not easy to pipeline proposals q p 1 p 2 l 1 p 2 takes over a continues to propose prop(c 1, 1) prop(c 2, 2) prop(c, 3) decide (c 1, 1) decide (c 2, 2) prop(b, 3) prop(b 4, 4) prop(c, 5) decide (c 1, 1) decide (c 2, 2) c 1 n n p 2 does not know the p 1 proposed c at 3 c 2 decide (c, 3) decide (c, 5) c c Two proposers p 1, p 2 l 1 is a learner 2/20/2012 decide (c, 5) 7

What is the problem? n We need to agree on each command q n

What is the problem? n We need to agree on each command q n We also need to agree on the sequence of commands q n Handled well by Paxos A mismatch with the consensus specification We would like to agree on a growing sequence of commands 21 October 2021 N. Ekström and S. Haridi 8

Consensus Mismatch n Integrity property says that a process can decide at most one

Consensus Mismatch n Integrity property says that a process can decide at most one value q n But, we don’t want to change what’s been decided before q n ”Cannot change one’s mind” Just extend with more information This is allowed by Sequence Consensus q Can decide again if new decided sequence is an extension of the previously decided sequence 21 October 2021 N. Ekström and S. Haridi 9

Consensus Properties n Validity q n Uniform Agreement q n No two processes decide

Consensus Properties n Validity q n Uniform Agreement q n No two processes decide different values Integrity q n Only proposed values may be decided Each process can decide at most one value Termination q Every correct process eventually decides a value 21 October 2021 N. Ekström and S. Haridi 10

Sequence Consensus Properties n Validity q n Uniform Agreement q n If process p

Sequence Consensus Properties n Validity q n Uniform Agreement q n If process p decides u and process q decides v then one is a prefix of the other Integrity q n If process p decides v then v is a sequence of proposed commands without duplicates If process p decides u and later decides v then u is a prefix of v Termination q If command C is proposed then eventually every correct process decides a sequence containing C 21 October 2021 N. Ekström and S. Haridi 11

Sequence Consensus n Event Interface q propose(C) n q decide(CS) n n request event

Sequence Consensus n Event Interface q propose(C) n q decide(CS) n n request event where C is a command Indication event where CS is a command sequence Abortable Sequence Consensus adds q abort n Indication event 21 October 2021 N. Ekström and S. Haridi 12

Road Map n Next unit q q q n Present an algorithm called Sequence

Road Map n Next unit q q q n Present an algorithm called Sequence Paxos This is derived from Paxos It is a variant of Multi-Paxos Later units q q Correctness Efficiency transformations 21 October 2021 N. Ekström and S. Haridi 13