A transaction coordinator directs distributed transaction participants to commit or roll back as a unit. In XA two-phase commit, participants first prepare their changes and vote while holding required locks; the coordinator then instructs them to commit or roll back based on the votes. section 9.1.2
Distributed coordination has practical constraints:
- XA transactions restrict technology choices because many modern databases and message brokers do not support them. section 9.1.2
- Synchronous interprocess communication can reduce availability, making distributed transactions a poor fit for many microservice architectures. section 9.1.2
Order and customer services
An Order Service initiates the global transaction; a Customer Service registers as a participant, and both services enlist their databases. The coordinator collects their prepare votes before directing the outcome. 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.
Shows service registration, database enlistment, participant votes, and the coordinator's commit or rollback instructions. section 9.1.2


