rsm paxos
play

RSM & Paxos Consensus Trilogy - Episode II Replicated State - PowerPoint PPT Presentation

RSM & Paxos Consensus Trilogy - Episode II Replicated State Machine What is the problem? Fault Tolerance by Replication KV-Store Client Fault Tolerance by Replication KV-Store Client set("s0", ...) Fault Tolerance by


  1. A Possible Solution set("s1", 25) set("s1", 1729) set("s1", 42) set("s1", 42) set("s1", 1729) KV-Store KV-Store Client Client Client set("s1", 25) set("s1", 42) set("s1", 1729)

  2. A Possible Solution set("s1", 42) set("s1", 42) set("s1", 25) set("s1", 25) set("s1", 1729) set("s1", 1729) KV-Store KV-Store Client Client Client set("s1", 25) set("s1", 42) set("s1", 1729)

  3. A Possible Solution set("s1", 42) set("s1", 42) KV-Store KV-Store set("s1", 25) set("s1", 25) set("s1", 1729) set("s1", 1729) Client Client Client set("s1", 25) set("s1", 42) set("s1", 1729)

  4. How to build fault tolerant oracles?

  5. What Do We Need? • Agreement on operation order.

  6. What Do We Need? • Agreement on operation order. • Validity to ensure operations executed were actually issued.

  7. Consensus Protocols • Termination : All correct nodes eventually decide on a value to output.

  8. Consensus Protocols • Termination : All correct nodes eventually decide on a value to output. • Agreement : All decided nodes decide on the same value.

  9. Consensus Protocols • Termination : All correct nodes eventually decide on a value to output. • Agreement : All decided nodes decide on the same value. • Validity : The decision must be one of the inputs.

  10. Consensus Protocols • Termination : All correct nodes eventually decide on a value to output. • Eventual Agreement : All decided nodes eventually decide on the same value. • Validity : The decision must be one of the inputs.

  11. Welcome to Paxos

  12. Outline • Going to go over single-decree Paxos. • Lamport's paper. Idea is to understand when and why it works. • Then look at how to apply this idea to build out a RSM.

  13. Outline • Going to go over single-decree Paxos. • Lamport's paper. Idea is to understand when and why it works. • Then look at how to apply this idea to build out a RSM.

  14. Single Decree Paxos

  15. Three Types of Participants Proposers

  16. Three Types of Participants Proposers Acceptors

  17. Three Types of Participants Proposers Acceptors Learners

  18. Three Types of Participants Propose values that should be selected from. Proposers Acceptors Learners

  19. Three Types of Participants Propose values Decide what value that should is ultimately accepted. be selected from. Proposers Acceptors Learners

  20. Three Types of Participants Propose values Are told what decision Decide what value that should was made and can then is ultimately accepted. be selected from. act on the decision. Proposers Acceptors Learners

  21. Paxos: Requirements • Validity : Acceptors should only choose values that are proposed.

  22. Paxos: Requirements • Validity : Acceptors should only choose values that are proposed. • Agreement : Only one value should be chosen.

  23. Achieving Agreement • Relies on both proposers and acceptors .

  24. Achieving Agreement • Relies on both proposers and acceptors . • Acceptors make sure that a chosen value cannot be forgotten.

  25. Achieving Agreement • Relies on both proposers and acceptors . • Acceptors make sure that a chosen value cannot be forgotten. • How?

  26. Achieving Agreement • Relies on both proposers and acceptors . • Acceptors make sure that a chosen value cannot be forgotten. • How? • Proposers make sure that they don't try to override a chosen value.

  27. Achieving Agreement • Relies on both proposers and acceptors . • Acceptors make sure that a chosen value cannot be forgotten. • How? • Proposers make sure that they don't try to override a chosen value. • How?

  28. Paxos Invariants • Each proposal has a unique ID. [For example use machine ID to ensure this].

  29. Paxos Invariants Proposal: (id, value) • Each proposal has a unique ID. [For example use machine ID to ensure this].

  30. Paxos Invariants Proposal: (id, value) • Each proposal has a unique ID. [For example use machine ID to ensure this]. • Need to make sure proposals are totally ordered .

  31. Paxos Invariants Proposal: (id, value) • Each proposal has a unique ID. [For example use machine ID to ensure this]. • Need to make sure proposals are totally ordered . • If some proposal with ID i and value v is chosen then

  32. Paxos Invariants Proposal: (id, value) • Each proposal has a unique ID. [For example use machine ID to ensure this]. • Need to make sure proposals are totally ordered . • If some proposal with ID i and value v is chosen then • all proposals with ID > i must also have value v.

  33. Paxos Invariants (1, a) Proposal: (id, value) (2, b) (3, a) Chosen (4, a) (5, a) • Each proposal has a unique ID. [For example use machine ID to ensure this]. • Need to make sure proposals are totally ordered . • If some proposal with ID i and value v is chosen then • all proposals with ID > i must also have value v.

  34. Paxos Protocol: Phase 1 Want to propose cake Proposal: (0, z) prepare (1, a) Accepted: ∅ p r a e p a r e ( 1 , a ) Proposal: (0, z) Accepted: ∅ prepare (1, a) b Proposal: (0, z) Accepted: ∅ c Proposal: (0, z) Accepted: ∅ Proposal ID: (<index>, <Sequence #>) Prepare Message: prepare <proposal ID>

  35. Paxos Protocol: Phase 1 promise (1, a) ∅ Want to propose cake Proposal: (1, a) Accepted: ∅ p r o m i s e a ( 1 , a ) ∅ promise (1, a) ∅ Proposal: (1, a) Accepted: ∅ b Proposal: (1, a) Accepted: ∅ c Proposal: (0, z) Accepted: ∅ Promise Message: promise <proposal ID> <accepted value>

  36. Paxos Protocol: Phase 2 Want to propose cake accept (1, a) cake Proposal: (1, a) Accepted: ∅ a c c e a p t ( 1 , a ) c a k e accept (1, a) cake Proposal: (1, a) Accepted: ∅ b Proposal: (1, a) Accepted: ∅ c Proposal: (0, z) Accepted: ∅ Accept Message: accept <proposal ID> <value>

  37. Paxos Protocol: Phase 2 Proposal: (1, a) Want to propose cake Accepted: cake a Proposal: (1, a) Accepted: cake b accepted cake Proposal: (1, a) Accepted: cake c Proposal: (0, z) Accepted: ∅

  38. Paxos Protocol: Phase 1 Proposal: (1, a) Accepted: cake a Proposal: (1, a) Want to propose ice cream prepare (1, b) Accepted: cake p b r e p a r e ( 1 , b ) Proposal: (1, a) prepare (1, b) Accepted: cake c Proposal: (0, z) Accepted: ∅ Prepare Message: prepare <proposal ID>

  39. Paxos Protocol: Phase 1 Proposal: (1, a) Accepted: cake a Proposal: (1, b) promise (1, b) cake Want to propose ice cream Accepted: cake p r o 😟 b m i s e ( 1 , b ) c a k e promise (1, b) ∅ Proposal: (1, b) Accepted: cake c Proposal: (1, b) Accepted: ∅ Promise Message: promise <proposal ID> <accepted value>

  40. Paxos Protocol: Phase 2 Proposal: (1, a) Accepted: cake a Proposal: (1, b) accept (1, b) cake Want to propose ice cream Accepted: cake a c b c e p t ( 1 , b ) c a k e accept (1, b) cake Proposal: (1, b) Accepted: cake c Proposal: (1, b) Accepted: ∅ Prepare Message: prepare <proposal ID>

  41. Paxos Protocol: Phase 2 Proposal: (1, a) Accepted: cake a Proposal: (1, b) Accepted: cake b Proposal: (1, b) Accepted: cake c Proposal: (1, b) Accepted: cake

  42. Paxos: Some Questions • Why do proposers need to pick the last committed value returned in Phase 1?

  43. Paxos: Some Questions Proposal: (1, a) Accepted: cake Proposal: (1, a) a Accepted: cake Proposal: (1, b) b Accepted: cannoli Proposal: (1, b) c Accepted: cannoli Proposal: (1, b) Accepted: cannoli

  44. Paxos: Some Questions Proposal: (1, a) Accepted: cake Proposal: (1, a) a Accepted: cake Is it possible to reach this situation? Proposal: (1, b) b Accepted: cannoli Proposal: (1, b) c Accepted: cannoli Proposal: (1, b) Accepted: cannoli

  45. Paxos: Some Questions Proposal: (1, a) Accepted: cake prepare (1, c) Proposal: (1, a) a Accepted: cake prepare (1, c) Proposal: (1, b) b prepare (1, c) Accepted: cannoli Proposal: (1, b) c Accepted: cannoli Want to propose cake Proposal: (1, b) Accepted: cannoli

  46. Paxos: Non-Termination

  47. Paxos Protocol: Phase 1 Proposal: (0, z) prepare (1, a) Accepted: ∅ p r e a p a r e ( 1 , a ) prepare (1, a) Proposal: (0, z) Accepted: ∅ b Proposal: (0, z) Accepted: ∅ c

  48. Paxos Protocol: Phase 1 promise (1, a) ∅ Proposal: (1, a) Accepted: ∅ p r o m a i s e ( 1 , a ) ∅ promise (1, a) ∅ Proposal: (1, a) Accepted: ∅ b Proposal: (1, a) Accepted: ∅ c

  49. Paxos Protocol: Phase 1 Proposal: (1, a) Accepted: ∅ prepare (1, b) a Proposal: (1, a) prepare (1, b) Accepted: ∅ prepare (1, b) b Proposal: (1, a) Accepted: ∅ c

  50. Paxos Protocol: Phase 1 Proposal: (1, b) Accepted: ∅ promise (1, b) ∅ a Proposal: (1, b) ) b ∅ , 1 ( e s m i o r p Accepted: ∅ p r o m b i s e ( 1 , b ) ∅ Proposal: (1, b) Accepted: ∅ c

  51. Paxos Protocol: Phase 1 Proposal: (1, b) Accepted: ∅ Accept for (1, a) will fail. a Proposal: (1, b) Accepted: ∅ b Proposal: (1, b) Accepted: ∅ c

  52. Paxos Protocol: Phase 1 Proposal: (1, b) prepare (2, a) Accepted: ∅ p r e p a r e a ( 2 , a ) prepare (2, a) Proposal: (1, b) Accepted: ∅ b Proposal: (1, b) Accepted: ∅ c

  53. Paxos Protocol: Phase 1 promise (2, a) ∅ Proposal: (2, a) Accepted: ∅ p r o m a i s e ( 2 , a ) ∅ promise (2, a) ∅ Proposal: (2, a) Accepted: ∅ b Proposal: (2, a) Accepted: ∅ c

  54. Paxos Protocol: Phase 1 Proposal: (2, a) Accepted: ∅ a Proposal: (2, a) Accepted: ∅ Accept for (1, b) will fail. b Proposal: (2, a) Accepted: ∅ c

  55. How to Resolve this Problem? • Elect a leader.

Recommend


More recommend