I am trying to understand the difference between paxos and two phase commit as means to reach consensus among multiple machines. Two phase commit and three phase commit is very easy to understand. It also seems that 3PC solves the failure problem that would block in 2PC. So I don't really understand what Paxos is solving. Can anyone illuminate me about what problem does Paxos exactly solve?
相关问题
- NOT DISTINCT query in mySQL
- Flush single app django 1.9
- keeping one connection to DB or opening closing pe
- Mysql-installer showing error : Memoy could not be
- Android Room Fetch data with dynamic table name
相关文章
- Connection pooling vs persist connection mysqli
- Speed up sqlFetch()
- How Do I Seed My Database in the setupBeforeClass
- I set a MySQL column to “NOT NULL” but still I can
- Where in Django can I run startup code that requir
- Google OAuth 2.0 User id datatype for MYSQL
- Restore deleted records in PostgreSQL
- SQLSTATE[HY000] [2002] Permission denied
2PC blocks if the transaction manager fails, requiring human intervention to restart. 3PC algorithms (there are several such algorithms) try to fix 2PC by electing a new transaction manager when the original manager fails.
Paxos does not block as long as a majority of processes (managers) are correct. Paxos actually solves the more general problem of consensus, hence, it can be used to implement transaction commit as well. In comparison to 2PC it requires more messages, but it is resilient to manager failures. In comparison to most 3PC algorithms, Paxos renders a simpler, more efficient algorithm (minimal message delay), and has been proved to be correct.
Gray and Lamport compare 2PC and Paxos in an excellent paper titled "Consensus on Transaction Commit".
(In the answer of peter, I think he is mixing 2PC with 2PL (two-phase locking).)
2-PC is the most traditional transaction commit protocol and powers the core of atomicity of transactions. But it is blocking in nature, i.e. if the transaction manager/coordinator fails in between, it will cause the protocol to block and no process will be aware of it. It requires manual intervention to repair the coordinator.
While Paxos being a distributed consensus protocol has multiple such coordinators and if a majority of the coordinators agree to the transaction completion, it becomes a successful atomic transaction.
You should read https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2003-96.pdf to understand how these two protocols are differentiated in a more granular manner. In the same paper, Lesley and Lamport also introduce a protocol i.e. a combination of Paxos and 2-PC for faster performance.