惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Cloudflare Blog
U
Unit 42
F
Fortinet All Blogs
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
Y
Y Combinator Blog
罗磊的独立博客
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
J
Java Code Geeks
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
爱范儿
爱范儿
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
I
InfoQ
博客园 - 叶小钗
博客园 - 聂微东
Last Week in AI
Last Week in AI

Arpit Bhayani

Temporal Primer - Building Long-Running Systems What Matters in Production RAG Structure of Every LLM Chat How LLMs Really Work Your Monolith Is Already A Distributed System Databases Were Not Designed For This BM25 JOIN Algorithms Venting at Work Comes at a Reputation Cost Why Half Your Skills Expire Every Few Years Multi-Paxos - Consensus in Distributed Databases MySQL Replication Internals Bloom Filters When You Increase Kafka Partitions Product Quantization The Q, K, V Matrices The Day I Accidentally Deleted Production How LLM Inference Works What are Blocking Queues and Why We Need Them Heartbeats in Distributed Systems How Writes Work in Apache Cassandra Redis Replication Internals How to Handle Arrogant Colleagues at Work How Does a CDN Handle Content Replication You Can't Fix Everything on Day One When Emotions Spill Over at Work Why gRPC Uses HTTP2 Meetings With No Agenda Are a Waste of Time Career Longevity Beats Constant Job Hopping Stay Relevant at Higher Salary Levels
Why Eventual Consistency is Preferred in Distributed Systems
Arpit Bhayani · 2025-09-03 · via Arpit Bhayani

One of the most fundamental trade-offs we face is choosing between consistency models - strong vs eventual.

While strong consistency might seem like the obvious choice - given it keeps the data perfectly synchronized at all times - the reality is that eventual consistency has become the preferred approach for most large-scale distributed systems. But why so…

To understand why eventual consistency dominates modern distributed architecture requires diving deep into

  • the CAP theorem
  • real-world network behaviors, and
  • the specific challenges that arise when building systems that serve millions of users across the globe.

Let’s dig into it.

Consistency Models

Strong Consistency

Strong consistency guarantees that all nodes in a distributed system see the same data at the same time. When a write operation completes, any subsequent read from any node will return that updated value.

Key characteristics:

  • Immediate consistency across all replicas
  • Linear ordering of operations
  • ACID properties are maintained globally

Eventual Consistency

Eventual consistency guarantees that, given enough time and no new updates, all replicas will converge to the same state. But, there’s no guarantee about when this convergence will happen, and different nodes may temporarily see different values.

Key characteristics:

  • Temporary inconsistencies are acceptable
  • Lower write latencies w/ async replication
  • Eventually, all replicas converge

The CAP Theorem: The Fundamental Trade-off

CAP theorem states that in any distributed system, you can only guarantee two of the following three properties:

  • Consistency (C): All nodes see the same data simultaneously
  • Availability (A): System remains operational even during failures
  • Partition Tolerance (P): System continues operating despite network partitions

Since network partitions are inevitable in distributed systems (networks fail, latency spikes occur, nodes become unreachable), partition tolerance is non-negotiable (unless you operate within your private DC with specialized h/w like Google). This forces us to choose between consistency and availability.

Real-World Implications

Consider a global e-commerce platform with data centers in New York, London, and Tokyo. When a user in Tokyo updates their profile, should the system:

  1. Choose Consistency: Block the operation until all data centers confirm the update (potentially taking 200-500ms due to cross-continental latency)
  2. Choose Availability: Allow the update to proceed immediately and propagate changes asynchronously

Most modern systems choose availability and lower latency - higher throughput, accepting temporary inconsistencies for better user experience.

Why Eventual Consistency Wins

Network Latency is Physics

The speed of light imposes fundamental limits on distributed systems. A round-trip between New York and Tokyo takes approximately 200ms at light speed — and real networks are much slower due to routing, processing delays, and congestion.

Strong consistency requires waiting for acknowledgments from all replicas before confirming a write. This means:

  • Global operations become as slow as the slowest network path
  • User-facing operations suffer from cross-continental latency
  • System throughput is limited by the synchronization overhead

Consider the following scenario

Example: User Profile Update

Strong Consistency: 

- User clicks "Save" → 0ms
- Wait for all replicas → 300ms (reality: network overhead)
- Confirm to user → 300ms total

Eventual Consistency:

- User clicks "Save" → 0ms  
- Write to local replica → 5ms
- Confirm to user → 5ms total
- Background sync to other replicas → happens asynchronously

Horizontal Scaling Challenges

As you add more nodes to a strongly consistent system, the coordination overhead grows exponentially. Each write operation must be synchronized across all replicas, creating bottlenecks that limit scalability.

With eventual consistency, new nodes can be added with minimal impact on existing performance. Each node can serve reads and writes independently, with synchronization happening in the background.

Availability and Fault Tolerance Benefits

Graceful Degradation

During network partitions or node failures, eventually consistent systems continue operating. Users in different regions can continue reading and writing data, even if some replicas are temporarily unreachable.

Strong consistency systems must either:

  • Reject writes when they can’t reach all replicas (reducing availability)
  • Risk data inconsistency if they allow writes during partitions

Real-World Failure Scenarios

Consider these common failure scenarios:

Submarine Cable Cut

When undersea cables are damaged, intercontinental connectivity can be severely impacted for hours or days. An eventually consistent system continues serving users in each region using local replicas, while a strongly consistent system might become unavailable for global operations.

Data Center Outage

If one of three data centers goes offline, an eventually consistent system operates at 2/3 capacity. A strongly consistent system might become read-only or completely unavailable, depending on its quorum requirements.

Cost Implications

Infrastructure Costs

Strong consistency requires:

  • More powerful hardware to maintain throughput
  • Redundant network connections for reliability
  • Lower resource utilization due to waiting for confirmations

Eventual consistency allows:

  • Higher resource utilization
  • Cheaper hardware (less coordination overhead)
  • More efficient use of network bandwidth

Practical Implementation Patterns

Read-Your-Own-Writes Consistency

Many systems implement a hybrid approach where users see their own writes immediately, but other users might see updates with some delay.

class UserProfileService:
    def update_profile(self, user_id, changes):
        # Write to local replica immediately
        local_replica.write(user_id, changes)
        
        # Add user to "recent writers" cache
        recent_writers.add(user_id, ttl=60)
        
        # Async replication to other replicas
        async_replicate(user_id, changes)
        
        return success_response
    
    def get_profile(self, user_id, requesting_user):
        if requesting_user == user_id and recent_writers.contains(user_id):
            # Read from local replica for consistency
            return local_replica.read(user_id)
        else:
            # Can read from any replica
            return any_replica.read(user_id)

Vector Clocks and Conflict Resolution

When conflicts arise in eventually consistent systems, vector clocks help determine the ordering of events:

class VectorClock:
    def __init__(self, node_id):
        self.node_id = node_id
        self.clock = {}
    
    def tick(self):
        self.clock[self.node_id] = self.clock.get(self.node_id, 0) + 1
    
    def update(self, other_clock):
        for node, timestamp in other_clock.items():
            self.clock[node] = max(self.clock.get(node, 0), timestamp)
        self.tick()
    
    def is_concurrent(self, other):
        # Two events are concurrent if neither happened-before the other
        return not (self.happened_before(other) or other.happened_before(self))

CRDT (Conflict-free Replicated Data Types)

CRDTs provide mathematical guarantees that concurrent updates can be merged without conflicts:

class GrowOnlyCounter:
    def __init__(self, node_id):
        self.node_id = node_id
        self.counters = {}
    
    def increment(self):
        self.counters[self.node_id] = self.counters.get(self.node_id, 0) + 1
    
    def value(self):
        return sum(self.counters.values())
    
    def merge(self, other):
        for node, count in other.counters.items():
            self.counters[node] = max(self.counters.get(node, 0), count)

Case Studies

Amazon DynamoDB

Amazon’s DynamoDB is eventually consistent by default, with optional strong consistency for specific read operations. This design choice enables:

  • Single-digit millisecond latency globally
  • Seamless scaling to millions of requests per second
  • 99.999% availability SLA

The trade-off is that applications must handle eventual consistency, but Amazon provides tools like conditional writes and transactions for scenarios requiring stronger guarantees.

DNS (Domain Name System)

DNS is perhaps the largest eventually consistent system in the world:

  • Changes propagate through the hierarchy over time (TTL-based)
  • Local caching improves performance but creates temporary inconsistencies
  • The system continues working even when parts of the hierarchy are unreachable

Facebook, Twitter, and Instagram all use eventual consistency for their feeds:

  • Posts appear immediately for the author
  • Followers see posts with slight delays (seconds to minutes)
  • Temporary inconsistencies are acceptable for the user experience
  • Global reach requires this approach for acceptable performance

When Strong Consistency is Still Necessary

Despite the advantages of eventual consistency, some scenarios require strong consistency:

Financial Transactions

Bank transfers, payment processing, and account balances require strong consistency to prevent:

  • Double-spending
  • Negative balances
  • Audit trail inconsistencies
# Bank transfer requiring strong consistency
def transfer_money(from_account, to_account, amount):
    with distributed_transaction():
        # Both operations must succeed or both must fail
        withdraw(from_account, amount)  # Must be atomic
        deposit(to_account, amount)     # across all replicas

What are we seeing today

Eventual consistency has become the dominant design choice, not because it is easier to implement, but because it aligns with the fundamental realities of distributed computing. Most modern systems treat consistency as a spectrum, tuning their approach to match business requirements and often blending strong and eventual consistency in hybrid models.

In practice, this means designing user experiences that gracefully absorb small delays. For example, if adding a brief animation (5 sec) after publishing a blog gives your system some time to catch up, then why bother implementing and enforcing strong consistency.

Like always, try to keep things simple and grounded to reality.