liveBook · Manning

Two-phase commit

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

Two-phase commit is a distributed transaction protocol that first obtains participant decisions and then instructs all participants to commit if every participant agrees.

Two-phase commit is a distributed transaction protocol in which a coordinator first asks every database node whether a change can succeed, then instructs all nodes to commit only when every node agrees. section 12.0

A simplified transaction proceeds in two phases:

  • The coordinator sends a commit request to each node, and each node checks whether the query can execute. section 12.0
  • Each node returns a yes-or-no decision; if every node agrees, the coordinator instructs all nodes to commit. section 12.0
  • After agreeing, nodes must fulfill the commit request, while coordination overhead increases as more nodes join the cluster. section 12.0
Figure 12.1 The communication overhead between the nodes increases with every node that joins the cluster.

Use the figure to visualize how communication overhead grows as database-cluster nodes coordinate transactions. section 12.0

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Traces a simplified two-node protocol from query request through unanimous decision and final commit, then stops at scaling overhead.
Examples
Uses a two-node INSERT, UPDATE, or DELETE transaction coordinated through participant checks and a final commit.
What it assumes
Assumes database queries, database nodes, clusters, and ACID terminology while defining the commit sequence directly.
What you can do after
Evaluate the coordination cost that transactional guarantees impose when adding nodes to a relational database cluster.
How it connects
Connects distributed transactions with ACID guarantees, database clusters, relational databases, and NoSQL databases.

Also explained in

Compare how 4 books explain two-phase commit →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.