Databases 21 min read

Understanding Distributed Transactions, Consistency Models, and Commit Protocols

This article explains the fundamentals of distributed transactions, covering ACID properties, consistency models, sharding strategies, CAP and BASE theories, and compares two‑phase, three‑phase, and TCC commit protocols to illustrate how modern systems maintain data integrity across multiple nodes.

Architecture Digest
Architecture Digest
Architecture Digest
Understanding Distributed Transactions, Consistency Models, and Commit Protocols

Distributed transactions and distributed locks are challenging topics; this article starts from basic concepts, explaining transactions and the ACID properties (Atomicity, Consistency, Isolation, Durability) with banking examples.

It then discusses consistency models—strong, weak, and eventual consistency—and how sharding (vertical and horizontal) impacts transaction handling, introducing the problems that arise when data is split across multiple databases.

The article reviews the CAP theorem and BASE theory as theoretical foundations for distributed systems, highlighting the trade‑offs between consistency, availability, and partition tolerance.

Next, it details the Two‑Phase Commit (2PC) protocol, describing its voting and commit phases, the role of the coordinator and participants, and its drawbacks such as single‑point failure, synchronous blocking, and potential data inconsistency.

It proceeds to the Three‑Phase Commit (3PC) protocol, introducing a pre‑check phase and timeout strategies that reduce blocking time and improve reliability, while noting that efficiency concerns still limit its adoption.

Finally, the Try‑Confirm‑Cancel (TCC) pattern is presented as a service‑level alternative to 2PC, outlining its three steps (resource reservation, confirmation, and cancellation), workflow, and advantages for high‑performance systems.

Vertical Sharding Diagram
Vertical Sharding Diagram
Two‑Phase Commit Diagram
Two‑Phase Commit Diagram
Three‑Phase Commit Diagram
Three‑Phase Commit Diagram
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

shardingtccACIDtwo-phase committhree-phase commit
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.