Skip to content
StackDecode
System Design
5. Advanced Database ArchitectureAnimated

Three-Phase Commit (3PC)

2PC with an extra pre-commit phase to avoid blocking.

The idea

An extra step lets participants decide on timeout, reducing blocking but not solving partitions.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

CoordinatorParticipant AParticipant BCAN COMMIT?
  • current message
  • earlier
  • failure or attack

Phase 1: ask whether each participant could commit.

step:
1/6
from:
Coordinator
to:
Participant A
1/6

Time runs downward. Solid arrows are requests, dashed arrows are replies.

Step by step

  1. 1Can-commit query
  2. 2Pre-commit
  3. 3Do-commit
  4. 4Timeouts let nodes move forward

Where it is used

Teaching and some niche systems.

Watch out for

Rarely used. Consensus-based systems are preferred.

Related