XA (eXtended Architecture)

Summary: A standard interface for two-phase commit across heterogeneous systems (e.g., a database and a message broker).

Sources: chapter9

Last updated: 2026-04-18


The XA standard, introduced in 1991, provides a way for a transaction coordinator (TM) to communicate with multiple resource managers (RMs).

Implementation

  • Resource Manager (RM): The system storing the data (e.g., PostgreSQL, RabbitMQ). It must implement the XA interface.
  • Transaction Manager (TM): The coordinator that manages the two-phase commit process (e.g., an application library or JTA implementation) (source: chapter9, p. 365).

Shortcomings

  • Performance: XA introduces significant overhead due to the multiple network round-trips required for the two-phase commit protocol (source: chapter9, p. 366).
  • Blocking: If the coordinator crashes between the prepare and commit phases, the transaction remains in “in-doubt” status, potentially holding locks on all involved resource managers for an indefinite period (source: chapter9, p. 364).
  • Complexity: Operations like recovery after a crash can be very complex to implement and debug across heterogeneous systems.