Part 2: The Blocking Trap
Two-Phase Commit (2PC) is the most famous distributed transaction protocol, but it is rarely used in high-scale cloud environments. Why? Because it is blocking.
1. The Handshake
2PC involves a Coordinator and Participants.
- Prepare: Coordinator asks if everyone can commit.
- Commit: If everyone says yes, the coordinator sends the commit signal.
2. The Failure Mode
If the coordinator crashes after the "Prepare" phase, every participant remains locked. They cannot release their database locks because they don't know if the final result was a Commit or an Abort. This "Wait State" is the killer of throughput.
Next: Part 3: The Saga Pattern
