Skip to content
StackDecode
System Design
5. Advanced Database Architecture6. Distributed Systems FundamentalsAnimated

Distributed Transactions

Transactions that span multiple databases or services.

The idea

A coordinator ensures all participants commit or all abort.

Watch it work

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

CoordinatorParticipant AParticipant BPREPARE
  • current message
  • earlier
  • failure or attack

Phase 1: the coordinator asks everyone if they can commit.

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

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

Step by step

  1. 1Coordinator begins
  2. 2Participants do their part
  3. 3Everyone votes
  4. 4All commit or all abort

Where it is used

Cross-service operations.

Watch out for

Slow, and blocks on coordinator failure. Often replaced by sagas.

Related