PrepZone Logo
PrepZone
Back to Database

Database · Hard

Explain two-phase commit (2PC) and XA transactions. Why are they avoided in microservices?

DatabaseTransactionsStaffDistributed Systems

Answer preview

Two-phase commit (2PC) is an atomic commit protocol that lets several independent resource managers — two databases, a database and a JMS broker — commit or abort as a single unit, coordinated by a transaction manager. XA is the standard interface that implements it (in Java: JTA…