Why architecture matters here

2PC failures come from coordinator blocking + slow recovery. Architecture matters because the blocking case is what makes 2PC unpopular.

Advertisement

The architecture: every piece explained

The top strip is protocol. Coordinator. Prepare phase. Participants. Commit phase.

The middle row is safety. Coordinator log. Blocking on coordinator failure. Recovery / heuristics. Latency + availability tradeoffs.

The lower rows are practice. Alternatives. Use where fit. Ops — timeouts + drills.

Two-phase commit — coordinator + participants + prepare + commit + why sagas replaced itatomic commit across shards, with caveatsCoordinatordrives protocolPrepare phasevote yes/noParticipantseach shardCommit phaseall-or-nothingCoordinator logdurable decisionBlocking on coordinator failurein-doubt stateRecovery / heuristicsmanualLatency + availability tradeoffswhy avoidedAlternativessagas + LWT + choreographyUse where fitsmall groups + short txnsOps — timeouts + observability + drillsloghangresolvecompareswapfitfitoperateoperate
Two-phase commit: prepare + commit with coordinator log.
Advertisement

End-to-end flow

End-to-end: coordinator sends prepare to 3 participants. All vote yes. Coordinator writes commit decision to log. Broadcasts commit. All participants ack. Compare failure case: coordinator crashes after logging but before broadcasting; on restart, replay log and resend commit. If log lost, participants stay in-doubt.