AlgoMaster Logo

Three-phase commit (3PC)

Ashish

Ashish Pratap Singh

5 min read

Three-Phase Commit (3PC) is an extension of the Two-Phase Commit protocol designed to manage distributed transactions across multiple systems. In a distributed transaction, ensuring that all participating nodes (or systems) either commit or abort the transaction is critical for data consistency. 3PC improves upon 2PC by adding an additional phase to minimize the risk of blocking—a situation where nodes are left in an uncertain state if a coordinator fails during the transaction process.

In essence, 3PC divides the process into three distinct phases:

  • CanCommit (Prepare) Phase: Nodes prepare to commit and indicate readiness.
  • PreCommit Phase: Nodes are notified to get ready to commit, but the transaction is not yet finalized.
  • DoCommit Phase: The final commit is executed, or an abort is initiated if problems are detected.

1. Why Use 3PC?

Premium Content

This content is for premium members only.