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

推荐订阅源

T
Tenable Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Vulnerabilities – Threatpost
G
GRAHAM CLULEY
Simon Willison's Weblog
Simon Willison's Weblog
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Privacy International News Feed
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Secure Thoughts
MyScale Blog
MyScale Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Cloudflare Blog
美团技术团队
Recorded Future
Recorded Future
T
Tailwind CSS Blog
Latest news
Latest news
Security Archives - TechRepublic
Security Archives - TechRepublic
Security Latest
Security Latest
Know Your Adversary
Know Your Adversary
Cloudbric
Cloudbric
Schneier on Security
Schneier on Security
I
Intezer
L
LINUX DO - 热门话题
P
Palo Alto Networks Blog
云风的 BLOG
云风的 BLOG
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Attack and Defense Labs
Attack and Defense Labs
人人都是产品经理
人人都是产品经理
L
LangChain Blog
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
L
Lohrmann on Cybersecurity
S
SegmentFault 最新的问题
W
WeLiveSecurity
C
Cybersecurity and Infrastructure Security Agency CISA
S
Securelist
SecWiki News
SecWiki News
V2EX - 技术
V2EX - 技术
IT之家
IT之家
Cyberwarzone
Cyberwarzone
F
Full Disclosure
Spread Privacy
Spread Privacy
阮一峰的网络日志
阮一峰的网络日志

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 Distributed Systems Need Consensus Algorithms Like Raft Why Do Databases Deadlock and How Do They Resolve It Why and How Cache Locality Can Make Your Code Faster Why does DNS use both UDP and TCP Should You Do a Master's My Honest Take Empathy Makes Great Engineers Unstoppable Good Mentors Build People, Not Just Skills Why You Should Always Have Back-Burner Projects Before You Push Back, Know What You're Standing On Be the One They Can Count On How Much Are People Willing to Bet on You How to Get Leadership to Say Yes to Your Project Don't Let Your Best Ideas Die in Silence Be the Person Everyone Wants to Work With The XY Problem and How to Avoid It The Startup Hiring Lie Nobody Talks About You Won't Be Promoted Unless You Ask It's Not Enough to be Right; Learn to be Heard No One Ships Great Software Alone You Don't Win by Proving Others Wrong Appreciate Generously; It Costs Nothing, But Builds Everything Your Soft Skills Aren't Soft at All Before you form an opinion, experience it Why You Need Both Curiosity and Action to Thrive A Daily Worklog Changed Everything How We Handle Mistakes Defines Us Own Your Mistakes Don't Wait. Step Up. Temporary Fixes Are Permanent Why Interviews Are Biased And What Sets You Apart Saying 'This isn't my problem' is actually the problem How to Write Effective OKRs Never Lose a Battle due to Miscommunication When In Doubt, Code It Out How to Follow Up Without Annoying People Lead Projects That Land, Execution Over Everything Abstract Thinking Will Define Your Next Decade We Engineers Suck at Task Estimation Shiny Obect Syndrome in Tech When to Change Jobs - The 3P Framework Comfort and Competition - Know When to Switch Gears Paper Notes - On-demand Container Loading in AWS Lambda Paper Notes - SQL Has Problems. We Can Fix Them Pipe Syntax In SQL Paper Notes - NanoLog - A Nanosecond Scale Logging System Don't Wait, Learn - The Best Resource is Mythical Paper Notes - WTF - The Who to Follow Service at Twitter The Unexpected Benefit of Reading Random Engineering Articles Roadmaps Are Limiting Your Growth Stop Leaving Money on the Table - Negotiate Your Job Offer Never Bad-Mouth Your Past Employers Show You're a Culture Fit Quantify your resume, Know Your Numbers The Importance of Being Likeable in Interviews Questions to Ask Your Interviewer How to Build Trust Through Collaboration Do This, Once You Are Out of the Interview Cycle Stop Pitching Ideas, Start Pitching Projects Read Those Design Docs, Even the Ones That Seem Irrelevant The Best Engineering Lessons Happen During Outages Great Engineers Start Broad LLM Summaries are Ruining Your Learning Turn System Design Interviews into Discussions Title Inflation At Work, Find Your Own Projects 6 Simple Strategies to Cracking Any Tech Interview How to Remain Unblocked Solving the Knapsack Problem with Evolutionary Algorithms Generating Pseudorandom Numbers with LFSR Local vs Global Indexes in Partitioned Databases Partitioning Data - Range, Hash, and When to Use Them
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.