Basic Paxos Implementation in Orc

Hemanth Kumar Mantri
Hemanth Kumar MantriGraduate Teaching Assistant
Classic Paxos Implemented in Orc
Hemanth Kumar Mantri
Makarand Damle
Term Project CS380D (Distributed Computing)
Consensus
• Agreeing on one result
among a group of
participants
• Consensus protocols are
the basis for the state
machine approach in
distributed computing
• Difficult to achieve when
the participants or the
network fails
Introduction
• To deal with Concurrency
– Mutex and semaphore
– Read/Write locks in 2PL for transaction
• In distributed system
– No global master to issue locks
– Nodes/Channels Fail
Applications
• Chubby
– Distributed lock service by Google
– Provides Coarse grained locking for
distributed resources
• Petal
– Distributed virtual disks
• Frangipani
– A scalable distributed file system.
Why Paxos?
• Two Phase Commit (2PC)
– Coordinator Failures!!
• Three Phase Commit (3PC)
– Network Partition!!!
• Paxos
– Correctness guaranteed
– No liveness guaranteed
2PC
Initial
U
Abort
Commi
t
Prepare
(to all)
Abort
Abort (to all)All Ready
Commit
(to all)
TimeOut
Abort
(to all)
Initial
Ready
Abort
Commi
t
Prepare
Ready
Abort
ACK
Commit
ACK
Coordinator Participant
What’s Wrong?
• Coordinator Fails
– In Phase1
• Participants can reelect a
leader and restart
– In Phase2
• Decision has been taken
• If at least 1 live participant
knows – OK!
• Participant(s) who know it
die(s):
– Reelection: Inconsistent
– BLOCKED till coordinator
recovers!!
• Participant Fails
– In Phase1
• Timeout and so Abort
– In Phase2
• Check with leader after
recovery
• None are Blocked
Problems
• 2PC not resilient to coordinator failures in
2nd phase
• Participants didn’t know about the leader’s
decision: Abort/Commit
• So, a new phase is introduced to avoid
this ambiguity
• ‘Prepare to Commit’
Solution – 3 PC
Init
U
A
C
Prepare
(to all)
Abort
Abort (to all)
All OK
Commit
(to all)
TimeOut
Abort
(to all)
Init
R
A
C
Prepare
Ready
PrepareCommit
OK
Commit
Coordinator Participant
BC
All Ready
Prepare Commit
(to all)
Not All OK
Abort (to all)
Prepare
Abort
PC
Abort
After Recovery
Recovery
• Coordinator Fails in 2nd Phase and also a
participant fails
– Participant: Should have been in PC
– Coordinator: Should have been in BC
– Others can re-elect and restart 3PC (nothing
committed)
• Coordinator fails in 3rd Phase:
– Decision Taken and we know what it is
– No need to BLOCK!
So, what’s wrong again?
• Network partition!!
A
D
B
C
Hub
Leader
New Leader
Problem
How to reach consensus/data consistency in
a given distributed system that can tolerate
non-malicious failures?
Requirements
• Safety
– Only a value that has been proposed may be chosen
– Only one value is chosen
– A node never learns that a value has been chosen unless
it actually has been
• Liveness
– Eventually,
• some proposed value is chosen
• a node can learn the chosen value
• When the protocol is run in 2F+1 processes, F
processes can fail
Terminology
• Classes/Roles of agents:
– Client
• issues a request, waits for response
– Proposers
• Proposes the Client’s request, convinces the Acceptors,
resolves conflicts
– Acceptors
• Accept/Reject proposed values and let the learners know if
accepted
– Learners
• Mostly serve as a replication factor
• A node can act as more than one agent!
Paxos Algorithm
• Phase 1:
– Proposer (Prepare)
• selects a proposal number N
• sends a prepare request with number N to all acceptors
– Acceptor (Promise)
• If number N greater than that of any prepare
request it saw
– Respond a promise not to accept any more proposals
numbered less than N
• Otherwise, reject the proposal and also indicate
the highest proposal number it is considering
Paxos algorithm Contd.
• Phase 2
– Proposer (Accept):
• If N was accepted by majority of acceptors, send accept
request to all acceptors along with a value ‘v’
– Acceptor (Accepted):
• Receives (N,v) and accept the proposal unless it has already
responded to a prepare request having a number greater
than N.
• If accepted, send this value to the Listeners to store it.
Paxos’ properties
• P1: Any proposal number is unique
– If there are T nodes in the system, ith node
uses {i, i+T, i+2T, ……}
• P2: Any two set of acceptors have at least
one acceptor in common.
• P3: Value sent out in phase 2 is the value
of the highest-numbered proposal of all
the responses in phase 1.
Learning a chosen value
• Various Options:
– Each acceptor, whenever it accepts a
proposal, informs all the learners
• Our implementation
– Acceptors inform a distinguished learner
(usually the proposer) and let the
distinguished learner broadcast the result.
Successful Paxos Round
Client Proposer Acceptors Learners
Request(v)
Prepare(N)
Promise(N)
Accept(N,v)
Accepted(N)
Response
Acceptor Failure – Okay!
Client Proposer Acceptors Learners
Request
Prepare(N)
Promise(N)
Accept(N,v)
Accepted(N)
Response
FAIL!
Proposer Failure – Re-elect!
Client Proposer Acceptors Learners
Request
Prepare(N)
Promise(N)
Prepare(N+1)
Promise(N+1)
FAIL!
New Leader
.
.
.
Dueling Proposers
Source: http://the-paper-trail.org/blog/consensus-protocols-paxos/
Issues
• Multiple nodes believe to be Proposers
• Simulate Failures
def class faultyChannel(p) =
val ch = Channel()
def get() = ch.get()
def put(x) =
if ((Random(99) + 1) :> p)
then ch.put(x)
else signal
stop
Implementation
• Learn which nodes are alive
– HeartBeat messages, Timeouts
• Simulate Node Failures
– Same as failing its out channels
• Stress test
– Fail and Unfail nodes at random times
– Ensure leader is elected and the protocol
continues
Optimizations
• Not required for correctness
• Proposer:
– Send only to majority of live acceptors (Cheap
Paxos’ Key)
• Acceptor can Reject:
– Prepare(N) if answered Prepare(M): M > N
– Accept(N,v) if answered Accept(M,u): M > N
– Prepare(N) if answered Accept(M,u): M > N
Possible Future Work
• Extend to include Multi-Paxos, Fast
Paxos, Byzantine Paxos etc
• Use remoteChannels to run across nodes
Questions
References
• Paxos made Simple, Leslie Lamport
• Orc Reference Guide
– http://orc.csres.utexas.edu/
• http://the-paper-trail.org/
• Prof Seif Haridi’s Youtube Video Lectures
1 of 28

Recommended

Chapter 11 by
Chapter 11Chapter 11
Chapter 11AbDul ThaYyal
3.8K views27 slides
Grokking Techtalk #39: Gossip protocol and applications by
Grokking Techtalk #39: Gossip protocol and applicationsGrokking Techtalk #39: Gossip protocol and applications
Grokking Techtalk #39: Gossip protocol and applicationsGrokking VN
635 views28 slides
Aggrement protocols by
Aggrement protocolsAggrement protocols
Aggrement protocolsMayank Jain
30.2K views17 slides
Chapter 6 pc by
Chapter 6 pcChapter 6 pc
Chapter 6 pcHanif Durad
3.4K views88 slides
Characterization of communication.ppt by
Characterization of communication.pptCharacterization of communication.ppt
Characterization of communication.pptAthira Ravindranathan
189 views30 slides
Fault tolerance-omer-rana by
Fault tolerance-omer-ranaFault tolerance-omer-rana
Fault tolerance-omer-ranaGangadhar Thippannagari
926 views33 slides

More Related Content

What's hot

Programming using MPI and OpenMP by
Programming using MPI and OpenMPProgramming using MPI and OpenMP
Programming using MPI and OpenMPDivya Tiwari
178 views32 slides
Randomized Byzantine Problem by Rabin by
Randomized Byzantine Problem by RabinRandomized Byzantine Problem by Rabin
Randomized Byzantine Problem by RabinKishor Datta Gupta
582 views51 slides
Algorithms & Complexity Calculation by
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity CalculationAkhil Kaushik
103 views33 slides
Operating system 27 semaphores by
Operating system 27 semaphoresOperating system 27 semaphores
Operating system 27 semaphoresVaibhav Khanna
51 views14 slides
DPRoPHET in Delay Tolerant Network by
DPRoPHET in Delay Tolerant NetworkDPRoPHET in Delay Tolerant Network
DPRoPHET in Delay Tolerant NetworkPhearin Sok
932 views25 slides
Performance measures by
Performance measuresPerformance measures
Performance measuresDivya Tiwari
99 views23 slides

What's hot(9)

Programming using MPI and OpenMP by Divya Tiwari
Programming using MPI and OpenMPProgramming using MPI and OpenMP
Programming using MPI and OpenMP
Divya Tiwari178 views
Algorithms & Complexity Calculation by Akhil Kaushik
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
Akhil Kaushik103 views
DPRoPHET in Delay Tolerant Network by Phearin Sok
DPRoPHET in Delay Tolerant NetworkDPRoPHET in Delay Tolerant Network
DPRoPHET in Delay Tolerant Network
Phearin Sok932 views
Distributed Mutual Exclusion and Distributed Deadlock Detection by SHIKHA GAUTAM
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
SHIKHA GAUTAM4.1K views

Viewers also liked

Paxos by
PaxosPaxos
Paxosnobu_k
2.7K views64 slides
the Paxos Commit algorithm by
the Paxos Commit algorithmthe Paxos Commit algorithm
the Paxos Commit algorithmpaolos84
5.4K views15 slides
Paxos introduction by
Paxos introductionPaxos introduction
Paxos introduction宗志 陈
2.7K views25 slides
图解分布式一致性协议Paxos 20150311 by
图解分布式一致性协议Paxos 20150311图解分布式一致性协议Paxos 20150311
图解分布式一致性协议Paxos 20150311Cabin WJ
1.4K views51 slides
Basic JavaScript Tutorial by
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript TutorialDHTMLExtreme
3.8K views134 slides
An Introduction to ReactJS by
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJSAll Things Open
12.7K views43 slides

Viewers also liked(14)

Paxos by nobu_k
PaxosPaxos
Paxos
nobu_k2.7K views
the Paxos Commit algorithm by paolos84
the Paxos Commit algorithmthe Paxos Commit algorithm
the Paxos Commit algorithm
paolos845.4K views
Paxos introduction by 宗志 陈
Paxos introductionPaxos introduction
Paxos introduction
宗志 陈2.7K views
图解分布式一致性协议Paxos 20150311 by Cabin WJ
图解分布式一致性协议Paxos 20150311图解分布式一致性协议Paxos 20150311
图解分布式一致性协议Paxos 20150311
Cabin WJ1.4K views
Basic JavaScript Tutorial by DHTMLExtreme
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript Tutorial
DHTMLExtreme3.8K views
An Introduction to ReactJS by All Things Open
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
All Things Open12.7K views
Reactjs by Neha Sharma
Reactjs Reactjs
Reactjs
Neha Sharma10.6K views
Introduction to Node.js by Vikash Singh
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Vikash Singh71.2K views
JavaScript - An Introduction by Manvendra Singh
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
Manvendra Singh19.1K views
React JS and why it's awesome by Andrew Hull
React JS and why it's awesomeReact JS and why it's awesome
React JS and why it's awesome
Andrew Hull108K views
The paxos commit algorithm by ahmed hamza
The paxos commit algorithmThe paxos commit algorithm
The paxos commit algorithm
ahmed hamza894 views

Similar to Basic Paxos Implementation in Orc

Chapter 11d coordination agreement by
Chapter 11d coordination agreementChapter 11d coordination agreement
Chapter 11d coordination agreementAbDul ThaYyal
3.8K views44 slides
L14.C3.FA18.ppt by
L14.C3.FA18.pptL14.C3.FA18.ppt
L14.C3.FA18.pptFarhanKhan371680
2 views57 slides
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com... by
Message Passing, Remote Procedure Calls and  Distributed Shared Memory as Com...Message Passing, Remote Procedure Calls and  Distributed Shared Memory as Com...
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com...Sehrish Asif
14.6K views41 slides
Chapter 11c coordination agreement by
Chapter 11c coordination agreementChapter 11c coordination agreement
Chapter 11c coordination agreementAbDul ThaYyal
710 views32 slides
techniques.ppt by
techniques.ppttechniques.ppt
techniques.pptveeruyadav9
5 views34 slides
The Beam Vision for Portability: "Write once run anywhere" by
The Beam Vision for Portability: "Write once run anywhere"The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"Knoldus Inc.
193 views30 slides

Similar to Basic Paxos Implementation in Orc(20)

Chapter 11d coordination agreement by AbDul ThaYyal
Chapter 11d coordination agreementChapter 11d coordination agreement
Chapter 11d coordination agreement
AbDul ThaYyal3.8K views
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com... by Sehrish Asif
Message Passing, Remote Procedure Calls and  Distributed Shared Memory as Com...Message Passing, Remote Procedure Calls and  Distributed Shared Memory as Com...
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com...
Sehrish Asif14.6K views
Chapter 11c coordination agreement by AbDul ThaYyal
Chapter 11c coordination agreementChapter 11c coordination agreement
Chapter 11c coordination agreement
AbDul ThaYyal710 views
The Beam Vision for Portability: "Write once run anywhere" by Knoldus Inc.
The Beam Vision for Portability: "Write once run anywhere"The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"
Knoldus Inc.193 views
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems by knowdiff
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time SystemsSara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems
knowdiff2.7K views
An overview of the process for handling enterprise client tickets by Mohammad Ali
An overview of the process for handling enterprise client ticketsAn overview of the process for handling enterprise client tickets
An overview of the process for handling enterprise client tickets
Mohammad Ali111 views
9 fault-tolerance by 4020132038
9 fault-tolerance9 fault-tolerance
9 fault-tolerance
40201320381.3K views
14 data link control by arvindsarja
14 data link control14 data link control
14 data link control
arvindsarja9K views
1 messagepassing-121015032028-phpapp01 by Zaigham Abbas
1 messagepassing-121015032028-phpapp011 messagepassing-121015032028-phpapp01
1 messagepassing-121015032028-phpapp01
Zaigham Abbas243 views
Process Synchronization -1.ppt by jayverma27
Process Synchronization -1.pptProcess Synchronization -1.ppt
Process Synchronization -1.ppt
jayverma2718 views
Distributed Consensus: Making the Impossible Possible by C4Media
Distributed Consensus: Making the Impossible PossibleDistributed Consensus: Making the Impossible Possible
Distributed Consensus: Making the Impossible Possible
C4Media1.4K views
Topic02-Architecture.pptx by ImXaib
Topic02-Architecture.pptxTopic02-Architecture.pptx
Topic02-Architecture.pptx
ImXaib2 views

More from Hemanth Kumar Mantri

TCP Issues in DataCenter Networks by
TCP Issues in DataCenter NetworksTCP Issues in DataCenter Networks
TCP Issues in DataCenter NetworksHemanth Kumar Mantri
1.5K views32 slides
Neural Networks in File access Prediction by
Neural Networks in File access PredictionNeural Networks in File access Prediction
Neural Networks in File access PredictionHemanth Kumar Mantri
720 views17 slides
Connected Components Labeling by
Connected Components LabelingConnected Components Labeling
Connected Components LabelingHemanth Kumar Mantri
2.3K views52 slides
JPEG Image Compression by
JPEG Image CompressionJPEG Image Compression
JPEG Image CompressionHemanth Kumar Mantri
6.8K views42 slides
Traffic Simulation using NetLogo by
Traffic Simulation using NetLogoTraffic Simulation using NetLogo
Traffic Simulation using NetLogoHemanth Kumar Mantri
3K views12 slides
Search Engine Switching by
Search Engine SwitchingSearch Engine Switching
Search Engine SwitchingHemanth Kumar Mantri
282 views30 slides

Recently uploaded

Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...ShapeBlue
117 views25 slides
The Power of Heat Decarbonisation Plans in the Built Environment by
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built EnvironmentIES VE
69 views20 slides
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
160 views29 slides
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...ShapeBlue
98 views29 slides
Data Integrity for Banking and Financial Services by
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial ServicesPrecisely
78 views26 slides
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...Bernd Ruecker
50 views69 slides

Recently uploaded(20)

Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue117 views
The Power of Heat Decarbonisation Plans in the Built Environment by IES VE
The Power of Heat Decarbonisation Plans in the Built EnvironmentThe Power of Heat Decarbonisation Plans in the Built Environment
The Power of Heat Decarbonisation Plans in the Built Environment
IES VE69 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc160 views
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti... by ShapeBlue
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
DRaaS using Snapshot copy and destination selection (DRaaS) - Alexandre Matti...
ShapeBlue98 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely78 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue85 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue179 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue176 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue144 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue140 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue154 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue88 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li80 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash153 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue138 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu365 views

Basic Paxos Implementation in Orc

  • 1. Classic Paxos Implemented in Orc Hemanth Kumar Mantri Makarand Damle Term Project CS380D (Distributed Computing)
  • 2. Consensus • Agreeing on one result among a group of participants • Consensus protocols are the basis for the state machine approach in distributed computing • Difficult to achieve when the participants or the network fails
  • 3. Introduction • To deal with Concurrency – Mutex and semaphore – Read/Write locks in 2PL for transaction • In distributed system – No global master to issue locks – Nodes/Channels Fail
  • 4. Applications • Chubby – Distributed lock service by Google – Provides Coarse grained locking for distributed resources • Petal – Distributed virtual disks • Frangipani – A scalable distributed file system.
  • 5. Why Paxos? • Two Phase Commit (2PC) – Coordinator Failures!! • Three Phase Commit (3PC) – Network Partition!!! • Paxos – Correctness guaranteed – No liveness guaranteed
  • 6. 2PC Initial U Abort Commi t Prepare (to all) Abort Abort (to all)All Ready Commit (to all) TimeOut Abort (to all) Initial Ready Abort Commi t Prepare Ready Abort ACK Commit ACK Coordinator Participant
  • 7. What’s Wrong? • Coordinator Fails – In Phase1 • Participants can reelect a leader and restart – In Phase2 • Decision has been taken • If at least 1 live participant knows – OK! • Participant(s) who know it die(s): – Reelection: Inconsistent – BLOCKED till coordinator recovers!! • Participant Fails – In Phase1 • Timeout and so Abort – In Phase2 • Check with leader after recovery • None are Blocked
  • 8. Problems • 2PC not resilient to coordinator failures in 2nd phase • Participants didn’t know about the leader’s decision: Abort/Commit • So, a new phase is introduced to avoid this ambiguity • ‘Prepare to Commit’
  • 9. Solution – 3 PC Init U A C Prepare (to all) Abort Abort (to all) All OK Commit (to all) TimeOut Abort (to all) Init R A C Prepare Ready PrepareCommit OK Commit Coordinator Participant BC All Ready Prepare Commit (to all) Not All OK Abort (to all) Prepare Abort PC Abort After Recovery
  • 10. Recovery • Coordinator Fails in 2nd Phase and also a participant fails – Participant: Should have been in PC – Coordinator: Should have been in BC – Others can re-elect and restart 3PC (nothing committed) • Coordinator fails in 3rd Phase: – Decision Taken and we know what it is – No need to BLOCK!
  • 11. So, what’s wrong again? • Network partition!! A D B C Hub Leader New Leader
  • 12. Problem How to reach consensus/data consistency in a given distributed system that can tolerate non-malicious failures?
  • 13. Requirements • Safety – Only a value that has been proposed may be chosen – Only one value is chosen – A node never learns that a value has been chosen unless it actually has been • Liveness – Eventually, • some proposed value is chosen • a node can learn the chosen value • When the protocol is run in 2F+1 processes, F processes can fail
  • 14. Terminology • Classes/Roles of agents: – Client • issues a request, waits for response – Proposers • Proposes the Client’s request, convinces the Acceptors, resolves conflicts – Acceptors • Accept/Reject proposed values and let the learners know if accepted – Learners • Mostly serve as a replication factor • A node can act as more than one agent!
  • 15. Paxos Algorithm • Phase 1: – Proposer (Prepare) • selects a proposal number N • sends a prepare request with number N to all acceptors – Acceptor (Promise) • If number N greater than that of any prepare request it saw – Respond a promise not to accept any more proposals numbered less than N • Otherwise, reject the proposal and also indicate the highest proposal number it is considering
  • 16. Paxos algorithm Contd. • Phase 2 – Proposer (Accept): • If N was accepted by majority of acceptors, send accept request to all acceptors along with a value ‘v’ – Acceptor (Accepted): • Receives (N,v) and accept the proposal unless it has already responded to a prepare request having a number greater than N. • If accepted, send this value to the Listeners to store it.
  • 17. Paxos’ properties • P1: Any proposal number is unique – If there are T nodes in the system, ith node uses {i, i+T, i+2T, ……} • P2: Any two set of acceptors have at least one acceptor in common. • P3: Value sent out in phase 2 is the value of the highest-numbered proposal of all the responses in phase 1.
  • 18. Learning a chosen value • Various Options: – Each acceptor, whenever it accepts a proposal, informs all the learners • Our implementation – Acceptors inform a distinguished learner (usually the proposer) and let the distinguished learner broadcast the result.
  • 19. Successful Paxos Round Client Proposer Acceptors Learners Request(v) Prepare(N) Promise(N) Accept(N,v) Accepted(N) Response
  • 20. Acceptor Failure – Okay! Client Proposer Acceptors Learners Request Prepare(N) Promise(N) Accept(N,v) Accepted(N) Response FAIL!
  • 21. Proposer Failure – Re-elect! Client Proposer Acceptors Learners Request Prepare(N) Promise(N) Prepare(N+1) Promise(N+1) FAIL! New Leader . . .
  • 23. Issues • Multiple nodes believe to be Proposers • Simulate Failures def class faultyChannel(p) = val ch = Channel() def get() = ch.get() def put(x) = if ((Random(99) + 1) :> p) then ch.put(x) else signal stop
  • 24. Implementation • Learn which nodes are alive – HeartBeat messages, Timeouts • Simulate Node Failures – Same as failing its out channels • Stress test – Fail and Unfail nodes at random times – Ensure leader is elected and the protocol continues
  • 25. Optimizations • Not required for correctness • Proposer: – Send only to majority of live acceptors (Cheap Paxos’ Key) • Acceptor can Reject: – Prepare(N) if answered Prepare(M): M > N – Accept(N,v) if answered Accept(M,u): M > N – Prepare(N) if answered Accept(M,u): M > N
  • 26. Possible Future Work • Extend to include Multi-Paxos, Fast Paxos, Byzantine Paxos etc • Use remoteChannels to run across nodes
  • 28. References • Paxos made Simple, Leslie Lamport • Orc Reference Guide – http://orc.csres.utexas.edu/ • http://the-paper-trail.org/ • Prof Seif Haridi’s Youtube Video Lectures