Core Idea

Distributed transactions are transactions that span multiple network nodes, coordinating atomic operations across databases, services, or systems in different physical locations.

Definition

Distributed transactions coordinate atomic operations across multiple nodes where each must commit together or all roll back—preventing inconsistent states where some operations succeed while others fail. Unlike local transactions with built-in ACID guarantees, distributed transactions require explicit coordination protocols to maintain consistency across network boundaries where partial failures, delays, and node crashes can occur.

Key Characteristics

  • Multi-node atomicity: All participating nodes must commit or all must abort; network failures and timeouts make this fundamentally harder than single-database transactions
  • Two-phase commit (2PC): The standard protocol—prepare phase acquires locks and solicits promises, commit phase coordinates the final outcome. It is blocking: if the coordinator crashes between phases, participants remain locked indefinitely
  • Long-lived transaction problem: 2PC is unsuitable for operations taking hours or requiring human input—holding locks blocks other work. The Saga-Pattern addresses this with compensating transactions and eventual consistency
  • CAP Theorem constraints: 2PC chooses consistency over availability; blocked nodes cannot serve other requests during coordination
  • X/Open XA standard: The de facto interface between transaction managers and resource managers, implemented by JTA and Jakarta EE

Why It Matters

When decomposing monoliths into microservices, automatic ACID consistency disappears. The choice becomes: maintain ACID across service boundaries via 2PC (tight coupling, reduced availability), or accept eventual consistency via sagas (availability and scalability, but compensation logic). Pat Helland’s “Life Beyond Distributed Transactions” argues 2PC does not scale to internet-scale systems. This decision fundamentally shapes system coupling and availability posture.

Sources

Note

This content was drafted with assistance from AI tools for research, organization, and initial content generation. All final content has been reviewed, fact-checked, and edited by the author to ensure accuracy and alignment with the author’s intentions and perspective.