FlowDiagram
UML: sequence, class & stateMermaid

Two-phase commit sequence diagram template

Shows a transaction coordinator running the prepare and commit phases of two-phase commit across three resource managers, including the abort path; used for distributed systems teaching. This sequence diagram template contains 5 labelled participants.

Open in the editor →
  • Free — no account, no trial, no watermark
  • Fully editable shapes and connectors, not a screenshot
  • Export PNG, SVG or PDF, or share it as a link
  • Private: the diagram never leaves your browser

Participants in this sequence diagram

  • Coordinator
  • Orders DB
  • Inventory DB
  • Payments DB
  • Transaction log

How to use this sequence diagram template

  1. Click Open in the editor. The sequence diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
  2. Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
  3. Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
  4. Prefer text? Edit the Mermaid source below and paste it in through ☰ → Import diagram (see the Mermaid editor); it imports as an editable diagram.
  5. Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.

Mermaid source

The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.

sequenceDiagram
  autonumber
  participant C as Coordinator
  participant A as Orders DB
  participant B as Inventory DB
  participant P as Payments DB
  participant Log as Transaction log
  C->>Log: Write BEGIN tx-77
  par Phase 1: prepare
    C->>A: PREPARE tx-77
    A-->>C: VOTE YES
  and
    C->>B: PREPARE tx-77
    B-->>C: VOTE YES
  and
    C->>P: PREPARE tx-77
    P-->>C: VOTE YES or NO
  end
  alt All voted YES
    C->>Log: Write COMMIT decision
    C->>A: COMMIT
    C->>B: COMMIT
    C->>P: COMMIT
  else Any NO or timeout
    C->>Log: Write ABORT decision
    C->>A: ROLLBACK
    C->>B: ROLLBACK
    C->>P: ROLLBACK
  end
  A-->>C: ACK
  Note over C,P: Participants hold locks until the decision arrives

Related: Mermaid editor · All uml: sequence, class & state templates · All 521 templates