liveBook · Manning

Commit phase

As explained in Microservices Patterns, Second Edition

The second phase of two-phase commit in which the coordinator instructs participants to commit or roll back according to their votes.

The commit phase is the second phase of two-phase commit (2PC). After participants prepare their changes and vote yes or no, the transaction coordinator instructs them to commit or roll back according to the votes. section 9.1.2

In a microservice architecture, 2PC can restrict technology choices and relies on synchronous communication, which reduces availability. Consider these constraints when choosing distributed transactions. section 9.1.2

Figure 9.1 A hypothetical implementation of XA/2PC in a microservice architecture. The services register as participants with the Transaction Coordinator. They enlist their databases in the distributed transaction. The Transaction Coordinator commits the transaction in two phases. In the prepare phases, participants vote on whether they can commit. In the commit phase, the transaction coordinator instructs all participants to either commit or roll back based on the collected votes.
microservices 2pc

Follow the coordinator, service participants, and databases through both phases of the transaction. section 9.1.2

How Microservices Patterns, Second Edition covers it

How deep it goes
Explains that the coordinator directs commit or rollback based on participant votes, without detailing implementation.
Examples
Illustrates Order Service and Customer Service participants enlisting their databases in a coordinated transaction.
What you can do after
Understand how participant votes determine the coordinator’s commit-or-rollback instructions.
How it connects
Connects two-phase commit with the prepare phase, transaction coordinators, and distributed transactions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.