6
$\begingroup$

Paxos is more powerful and in the famous writing "Consensus on Transaction Commit" : http://research.microsoft.com/pubs/64636/tr-2003-96.pdf, Jim Gray and Leslie Lamport describe 2PC as a special case of Paxos.

Why do relational database use 2PC in real world? Also 2PC is not fault tolerant because it uses a single coordinator whose failure can cause the protocol to block.

$\endgroup$
  • 1
    $\begingroup$ Google's Spanner is a relational database and it uses Paxos. $\endgroup$ – jkff Dec 4 '14 at 20:16
  • $\begingroup$ Probably because its implementation isn't trivial on strong transactional systems. Even tho, this is changing lately, ie: citusdata.com/blog/2016/04/13/masterless-distributed-queue $\endgroup$ – 3manuek Sep 4 '17 at 16:50
3
$\begingroup$

One of the reasons is the message complexity. For N nodes, 2PC will require 3N to be exchanged whereas Paxos requires 4N. Also, Paxos adds sequence numbers to each message which adds a significant overhead to the overall execution.

$\endgroup$
  • $\begingroup$ Thanks for the answer. A follow up question, Wikipedia mentions : "he greatest disadvantage of the two-phase commit protocol is that it is a blocking protocol. If the coordinator fails permanently, some cohorts will never resolve their transactions: After a cohort has sent an agreement message to the coordinator, it will block until a commit or rollback is received." How do real world production services resolve these problems? $\endgroup$ – Nitish Upreti Dec 4 '14 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.