Software Design

Two-Phase Commit Distributed Transaction Flow

UML Sequence Diagrams · made in Skemio

Sequence diagram showing Two-Phase Commit protocol with prepare phase, commit voting, global commit broadcast, and acknowledgement.
Sequence diagram showing Two-Phase Commit protocol with prepare phase, commit voting, global commit broadcast, and acknowledgement.

What it shows

  • Phase 1 (Prepare): Coordinator asks nodes to lock records and vote.
  • Phase 2 (Commit): Coordinator issues commit only if all votes are YES.
  • Coordinator failure while locks are held blocks the entire cluster.

The takeaway

2PC guarantees atomic consistency across nodes, but trades off availability and latency.

More uml sequence diagrams