Distributed Transaction

Distributed Transaction

ℹ️
It may be beneficial to review the Concurrency Control topic concerning transactions and consistency before proceeding with this section.

A distributed transaction is a single, logical transaction that spans multiple physical servers or nodes.

TransactionServer 1Server 2Server 3

The physical separation of these nodes introduces challenges in ensuring that distributed transactions fully adhere to the ACID properties (Atomicity, Consistency, Isolation, Durability). This adherence necessitates tight collaboration and coordination between the participating servers.

In some scenarios, a deliberate decision might be made to relax strict ACID compliance to gain other benefits, such as higher availability or lower coupling between services.

Regardless of the specific implementation details, any distributed transaction algorithm must guarantee that changes across all involved nodes are either committed together or aborted together (all or nothing).

Essentially, there are two primary approaches to consistency in distributed transactions:

  • Strong Consistency: Systems aiming for strong consistency require that a transaction is atomically committed across all relevant nodes. This means all parts of the transaction either succeed or fail as a single, indivisible unit.

    This model typically employs strict algorithms, often involving locking mechanisms, to ensure the Isolation property, preventing transactions from interfering with each other.

TransactionCommitNode ANode BNode C
  • Eventual Consistency: In this model, transactions are often decomposed into phases that may be committed at different times across various nodes.

    Due to this asynchronous behavior, the Isolation property is typically not implemented in the same strict sense as in strong consistency models. Instead, the system must be designed to implicitly avoid or resolve inconsistencies over time, eventually reaching a consistent state across all nodes.

TransactionNode ANode BNode CCommitCommitCommit
Last updated on