Understanding CAP, ACID, and BASE Theories Through the Metaphor of Tai Chi and Distributed Systems
This article uses the story of Tai Chi from the novel *The Heaven Sword and Dragon Saber* to explain the CAP theorem, ACID properties, BASE theory, and two‑phase commit in distributed systems, illustrating how consistency, availability, and partition tolerance correspond to the hard and soft aspects of Tai Chi.
The piece introduces a creative analogy that maps the martial art Tai Chi from the Chinese novel *The Heaven Sword and Dragon Saber* to three fundamental distributed‑system theories—CAP, ACID, and BASE—showing how the concepts of hardness and softness in Tai Chi reflect consistency, availability, and partition tolerance.
1. The Two Sides of Tai Chi
CAP theory abstracts distributed systems into three metrics: Consistency, Availability, and Partition Tolerance. The article demonstrates consistency with a read‑operation example where two nodes store a value A . After updating node 1 to A=5 , node 2 still returns A=1 , illustrating a consistency violation.
Availability is described as the system’s ability to respond even when some nodes are unreachable, sacrificing data correctness. Partition tolerance means the system continues operating despite network partitions.
"Consistency is the ‘hard’ side, Availability is the ‘soft’ side, and Partition Tolerance is the system’s resilience to network faults."
2. The Hard Side – ACID
ACID (Atomicity, Consistency, Isolation, Durability) is the classic set of properties for database transactions. The article explains that transactions can also appear in business logic, such as coupon issuance and inventory deduction.
To illustrate the two‑phase commit (2PC) protocol, the story of six sects besieging the Bright Summit is used. The steps are:
Phase 1 (Prepare): The coordinator (Shaolin) asks the other sects (Wudang, Kunlun) whether they can attack.
Phase 2 (Commit): If all reply "feasible", the coordinator orders the attack, and each sect executes the plan.
Code snippets from the original text are kept unchanged, e.g., 二阶段提交协议 and 提交请求阶段 .
The article also notes the drawbacks of 2PC—blocking if the coordinator fails—and introduces the three‑phase commit (TCC) as a mitigation that adds an inquiry stage and timeout handling.
3. The Soft Side – BASE
BASE expands the AP side of CAP: Basically Available, Soft state, Eventually consistent. It is presented as the "soft" counterpart to ACID’s strict consistency, similar to the flexible, flowing movements of Tai Chi.
Typical techniques for achieving basic availability are listed: traffic shaping, delayed responses, graceful degradation, and overload protection.
Eventual consistency is defined as the state where all replicas converge after a period of asynchronous synchronization, suitable for most internet services but not for financial systems that require strong consistency.
4. Putting It All Together
The conclusion ties the metaphor back to practice: just as Tai Chi emphasizes intent over fixed forms, engineers should understand the underlying principles of CAP, ACID, and BASE rather than memorizing them, enabling them to design distributed architectures that balance consistency, availability, and fault tolerance.
CAP provides the three core dimensions of distributed design.
ACID represents strong consistency (CP) for traditional databases.
BASE represents the flexible, eventually consistent approach (AP) common in NoSQL systems.
Two‑phase commit illustrates how distributed transactions achieve atomicity.
By mastering these theories, readers can better choose the right trade‑offs for their specific business scenarios.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.