Pattern 44 / CONSENSUS

Two-Phase Commit (2PC)

Use this when committing one transaction atomically across multiple participants.

Pressure
Committing one transaction atomically across multiple participants
Mechanism
Coordinator asks participants to prepare, then tells all to commit or abort
Toll
Blocking behavior, coordinator failure modes, and poor fit for long workflows
Architecture plate44
Diagram for Two-Phase Commit (2PC)
Executive brief

Two-Phase Commit (2PC) fits when committing one transaction atomically across multiple participants. Mechanism: coordinator asks participants to prepare, then tells all to commit or abort. Use it for rare cases requiring strong consistency across resources. The toll: blocking behavior, coordinator failure modes, and poor fit for long workflows.

Use when

Rare cases requiring strong consistency across resources.

Example

Two databases both prepared before a distributed commit.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Consistency Patterns

45Saga Pattern46Quorum47Vector Clocks
โ† 4345 โ†’