Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real world example of Paxos

Can someone give me a real-world example of how Paxos algorithm is used in a distributed database? I have read many papers on Paxos that explain the algorithm but none of them really explain with an actual example.

A simple example could be a banking application where an account is being modified through multiple sessions (i.e. a deposit at a teller, a debit operation etc..). Is Paxos used to decide which operation happens first? Also, what does one mean by multiple instances of Paxos protocol? How is when is this used? Basically, I am trying to understand all this through a concrete example rather than abstract terms.

like image 951
sjg Avatar asked May 08 '12 19:05

sjg


People also ask

What is Paxos used for?

Paxos is usually used where durability is needed to replicate large datasets, such as a file or a database. The protocol attempts to make progress even during periods when some bounded number of replicas are unresponsive.

Who uses Paxos?

Our Clients Paxos is a top-funded blockchain company with more than $500 million in total funding from leading investors like OakHC/FT, Declaration Partners, Mithril Capital and PayPal Ventures. Our clients are leading global enterprises.

Does Cassandra use Paxos?

Cassandra uses Paxos to elect central leader by default that causes collision problem. Among existent consensus algorithms Raft separates the key elements of consensus, such as leader election, so enforces a stronger degree of coherency to reduce the number of states that must be considered, such as collision.

Does MySQL use Paxos?

In this blog post, we will describe our Paxos-based solution, named eXtended COMmunications, or simply XCOM, which is a key component in the MySQL Group Replication. XCOM is responsible for disseminating transactions to MySQL instances that are members in a group and for managing their membership.


2 Answers

For example, we have MapReduce system where master consists of 3 hosts. One is master and others are slaves. The procedure of choosing master uses Paxos algorithm.

Also Chubby of Google Big Table uses Paxos: The Chubby Lock Service for Loosely-Coupled Distributed Systems, Bigtable: A Distributed Storage System for Structured Data

like image 122
Aligus Avatar answered Sep 25 '22 07:09

Aligus


The Clustrix database is a distributed database that uses Paxos in the transaction manager. Paxos is used by the database internals to coordinate messages and maintain transaction atomicity in a distributed system.

  • The Coordinator is the node the transaction originated on
  • Participants are the nodes that modified the database on behalf of
  • the transaction Readers are nodes that executed code on behalf of the transaction but did not modify any state
  • Acceptors are the nodes that log the state of the transaction.

The following steps are taken when performing a transaction commit:

  1. Coordinator sends a PREPARE message to each Participant.
  2. The Participants lock transaction state. They send PREPARED messages back to the Coordinator.
  3. Coordinator sends ACCEPT messages to Acceptors.
  4. The Acceptors log the membership id, transaction, commit id, and participants. They send ACCEPTED messages back to the Coordinator.
  5. Coordinator tells the user the commit succeeded.
  6. Coordinator sends COMMIT messages to each Participant and Reader.
  7. The Participants and Readers commit the transaction and update transaction state accordingly. They send COMMITTED messages back to the Coordinator.
  8. Coordinator removes internal state and is now done.

This is all transparent to the application and is implemented in the database internals. So for your banking application, all the application level would need to do is perform exception handling for deadlock conflicts. The other key to implementing a database at scale is concurrency, which is generally helped via MVCC (Multi-Version concurrency control).

like image 34
clieu Avatar answered Sep 24 '22 07:09

clieu