5 ms·
No, that's not correct. 2PC and paxos/raft solve different problems. 2PC is for distributed transactions across leaders / primaries. Paxos / Raft is for replica
by azurelake 5y ago
No, that's not correct. 2PC and paxos/raft solve different problems. 2PC is for distributed transactions across leaders / primaries. Paxos / Raft is for replication / consesus. Spanner is an example of a system that uses both.
- skyde 5y agoI agree with you but a better explanation I think is. Raft/Paxos is to make sure majority of the replica for a partition have the latest version of the data and that you can keep writing even if minority of nodes in that partition are unavailable. while still giving guarantee that no write get lost and all read reflect the most recent write. While 2PC is to write 2 records atomically when the 2 record are located on 2 different partitions.
- uvdn7 5y agoYes, it is correct. At a distance both 2pc and paxos are solving the consensus problem - a group of entities agreeing on _something_. In the 2pc case, the _something_ is commit or not. In the paxos case, the _something_ is the chosen value. 2pc cannot handle coordinator failure, a single point of failure if you will. Transaction commit and replication are both consensus problems. You can use paxos for transaction commit as well. Lamport has a paper on a protocol called Paxos Commit.
- azurelake 5y agoI see, guess I'm wrong then! What's the disadvantage of Paxos Commit vs 2PC? Presumably there's a reason that the Spanner team didn't use it for distributed transactions. edit: Looking at the paper, it looks like the tradeoff is increased amount of coordination needed. "The Two-Phase Commit protocol is thus the degenerate case of the Paxos Commit algorithm with a single acceptor." I suppose in Spanner, having more than one acceptor is redudant since each shard is a Paxos group anyways.
- klysm 5y agoSpanner is in a rather unique technical position which enables it to sit outside the tradoff space of most distributed systems. You certainly pay for being robust against coordinator failure though.