Fundamentals 9 min read

Understanding Distributed Consistency: Importance, Models, and Challenges

The article explains why consistency is essential in distributed systems, describes the CAP theorem, outlines various consistency models such as strong, weak, and eventual consistency, and discusses the trade‑offs between data correctness and system performance.

Architect
Architect
Architect
Understanding Distributed Consistency: Importance, Models, and Challenges

As large‑scale websites encounter increasing high‑concurrency access and massive data processing, achieving high availability, scalability, extensibility, and security becomes critical, driving the evolution of distributed architectures.

This piece builds on a previous introduction to distributed systems and focuses on consistency issues, covering basic concepts, importance, and consistency models.

Importance of Consistency

The CAP theorem tells us that a distributed system cannot simultaneously satisfy Consistency, Availability, and Partition tolerance; it can only achieve two of them. Nevertheless, consistency cannot be completely abandoned because without trustworthy data the system loses its value.

Some architects speak of sacrificing consistency in certain scenarios, but they usually refer to giving up strong consistency rather than consistency altogether.

In distributed environments, consistency typically refers to data consistency.

Data Consistency

Data consistency originates from database theory and can be understood as correctness or integrity of related data. In databases, transactions ensure consistency and integrity. In distributed systems, data consistency means that replicated copies across different nodes contain identical and complete information.

Why Data Consistency Problems Occur

Distributed deployment introduces data replication for two main reasons: availability and performance.

可用性。将数据复制到分布式部署的多台机器中,可以消除单点故障,防止系统由于某台(些)机器宕机导致的不可用。性能。通过负载均衡技术,能够让分布在不同地方的数据副本全都对外提供服务。有效提高系统性能。

After replication, network latency and other factors can cause divergent data among nodes, making consistency a challenge.

The classic ticket‑selling example illustrates how guaranteeing consistency can reduce performance because concurrent writes must be serialized.

Thus, achieving both consistency and performance requires careful trade‑offs, and consistency models provide guidance for these decisions.

Consistency Models

Strong Consistency

After an update completes, all subsequent reads return the latest value, offering the most user‑friendly experience but often at a high performance cost.

Weak Consistency

The system does not guarantee that reads will immediately reflect the most recent writes; it only promises eventual convergence within a certain time window.

Eventual Consistency

A specific form of weak consistency where, in the absence of further updates, the system eventually returns the last written value. DNS is a typical example.

Variants of Eventual Consistency

因果一致性:如果A进程在更新之后向B进程通知更新的完成,那么B的访问操作将会返回更新的值。如果没有因果关系的C进程将会遵循最终一致性的规则。读己所写一致性:因果一致性的特定形式。一个进程总可以读到自己更新的数据。会话一致性:读己所写一致性的特定形式。进程在访问存储系统同一个会话内,系统保证该进程读己之所写。单调读一致性:如果一个进程已经读取到一个特定值,那么该进程不会读取到该值以前的任何值。单调写一致性:系统保证对同一个进程的写操作串行化。

These variants can be combined; for example, monotonic read consistency together with read‑your‑writes consistency simplifies application development by reducing the need for extra handling of stale data.

To address distributed consistency, many classic protocols and algorithms have been proposed, such as two‑phase commit, three‑phase commit, and the Paxos algorithm. The next article will introduce these protocols in detail.

distributed systemsCAP theoremdata replicationconsistencyconsistency models
Architect
Written by

Architect

Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.

0 followers
Reader feedback

How this landed with the community

login 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.