Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 66

Understanding Eventual and Strong Consistency

Recommended resources

Introduction

Welcome to your next lesson on Cloud Computing. In our previous session, we discussed synchronous and asynchronous data replication, noting how they lead to different data consistency guarantees. We saw that synchronous replication provides strong consistency, while asynchronous replication results in eventual consistency.

Today, we will build directly on that foundation to formally address the learning outcome: Define eventual consistency and strong consistency as data consistency models in distributed storage.

This lesson will solidify your understanding of these two critical models, which are fundamental to how large-scale distributed systems (like cloud databases) function. We will move beyond just linking them to replication and explore them as core architectural principles. For your exam preparation, we will focus on precise definitions, clear visual explanations, and detailed tabular comparisons to help you articulate the trade-offs between them.



What is Consistency in a Distributed System?

Before diving into the two models, it's important to be crystal clear on what "consistency" means in this context. In a distributed system, where data is replicated across multiple servers (or nodes), consistency refers to the guarantee that all nodes will return the same, most up-to-date data to any user who queries them.

The short video clip below will quickly set the stage by defining a distributed system and the concept of consistency within it.

What is Eventual Consistency? | System Design

Watch this brief segment from the video 'What is Eventual Consistency? | System Design' by the roadmap channel. It provides a foundational definition of consistency in distributed systems.

Watch from 00:37 to 01:34. Focus on the definition of consistency as data being the same across all nodes, and understand the examples of what a distributed system is (e.g., a database with replicated nodes).

The core challenge that consistency models try to solve is this: how do you ensure all users see the correct data when that data lives in multiple places and is constantly being updated? Strong and eventual consistency are two different answers to this question.



Strong Consistency: Always Read the Latest Data

Strong consistency is the most intuitive and strictest model. It guarantees that any read operation will always return the value from the most recent successful write. From a user's perspective, the system behaves as if there is only a single, up-to-the-minute copy of the data.

This guarantee is achieved by ensuring that a write operation is only confirmed as "successful" after the new data has been propagated to all replicas (or at least a majority quorum). The application must wait for this process to complete.

The diagram below illustrates this flow. Notice how the client only receives a "success" acknowledgement after the write has been confirmed by all nodes in the cluster.

Comparison of Strict vs. Eventual Consistency
This diagram compares the data and acknowledgment flow for Strong (Strict) Consistency and Eventual Consistency. For **Strong Consistency**, the write must be propagated and acknowledged internally before the client receives confirmation. For **Eventual Consistency**, the client receives confirmation immediately, and the data propagates to other nodes in the background.

Use Cases & Implications

Strong consistency is mandatory for systems where data accuracy is non-negotiable.

What is the difference between Strong and Eventual Consistency?

This video from Software Developer Diaries provides excellent, practical examples of where strong consistency is essential.

Watch the segment from 02:11 to 04:09. Pay close attention to the examples given, such as banking applications, stock markets, and airline ticket booking systems. Note why eventual consistency would be disastrous in these scenarios.

As the video explained, any system dealing with financial transactions, inventory management, or reservations cannot tolerate even temporary inconsistencies. The cost of this strictness is higher latency (writes take longer) and potentially lower availability (the system might be unable to accept writes if a replica is down).



Eventual Consistency: Prioritizing Availability and Speed

Eventual consistency is a more relaxed model. It guarantees that if no new updates are made to a given data item, all replicas will eventually return the last updated value. However, for a period of time after a write, read requests might return the old (stale) data.

This is possible because the system confirms a write operation as "successful" as soon as the primary replica has been updated. The propagation to other replicas happens asynchronously in the background. This makes write operations very fast.

Use Cases & Implications

Eventual consistency is ideal for large-scale systems where high availability and low latency are more critical than immediate data consistency.

What is the difference between Strong and Eventual Consistency?

Let's return to the Software Developer Diaries video to see examples of where eventual consistency is a good trade-off.

Watch the first part of the video, from 00:00 to 02:11. Focus on the examples of updating a Facebook profile photo or an Amazon shopping cart. Understand why it's acceptable for these changes to take a few seconds to appear everywhere.

As you saw, applications like social media feeds, content delivery networks (CDNs), and some e-commerce features (like product catalogs) benefit greatly from this model. A user seeing an old profile picture for a few seconds is an acceptable trade-off for a fast and highly available system that can serve millions of users.



Formal Definitions and Comparison for Your Exam

To score full marks, you need to use precise terminology and be able to draw clear comparisons. The following reading from GeeksforGeeks provides the formal definitions, features, and a comprehensive comparison table that you should study carefully.

Strong Vs Eventual Consistency in System Design

Please read the selected sections from the article 'Strong Vs Eventual Consistency in System Design' on GeeksforGeeks. This will provide you with the formal definitions and a detailed comparison table perfect for exam revision.

Read the following three sections from the article: 'Strong Consistency': Focus on the features listed, such as Linearizability and Atomicity. 'Eventual Consistency': Focus on its features, like Convergence and High Availability. 'Strong vs. Eventual Consistency in System Design': Study the comparison table in detail. This table is a crucial study tool.

Key Characteristics Summary

Based on the reading, here are the key terms associated with each model:

  • Strong Consistency:

    • Linearizability: Operations appear to occur instantaneously and in a single, global order. This is the strongest form of consistency.
    • Read-after-Write Consistency: Guarantees that once a write is complete, any subsequent read will see that write.
    • Synchronous Updates: Relies on synchronous replication to keep all replicas in sync.
    • Prioritizes Consistency in the CAP theorem trade-off (Consistency, Availability, Partition Tolerance).
  • Eventual Consistency:

    • Convergence: All replicas are guaranteed to become consistent over time if no new writes occur.
    • Asynchronous Updates: Uses asynchronous replication, allowing for faster write acknowledgements.
    • High Availability & Scalability: The system can continue to operate and scale easily even if some nodes are temporarily unavailable.
    • Prioritizes Availability in the CAP theorem trade-off.

Comparison at a Glance

For a quick visual summary, the following image and table are excellent revision aids.

Strong Consistency vs. Eventual Consistency Comparison
This image provides a concise, bullet-point comparison of Strong and Eventual Consistency, highlighting key differences in data reads, latency, predictability, and scalability.

The table you studied in the GeeksforGeeks article is your primary tool for detailed exam answers. Here is a summary of the most critical comparison points:

Parameter Strong Consistency Eventual Consistency
Data Freshness Immediate. Reads always get the most recent write. Delayed. Reads might get stale data temporarily.
Latency (for writes) Higher. Must wait for replicas to sync. Lower. Acknowledges write before replicas are synced.
Availability Lower. Can become unavailable during network partitions. Higher. Can continue to operate during network partitions.
Scalability More challenging to scale due to synchronization overhead. Easier to scale horizontally.
Complexity More complex to implement at the infrastructure level. Application logic must handle potential data conflicts/staleness.
Core Use Cases Financial systems, inventory, booking systems. Social media, content delivery, analytics.


Conclusion

In this lesson, we formally defined and contrasted the two fundamental consistency models in distributed storage systems. Understanding this trade-off is essential for designing or analyzing any large-scale cloud application.

Key Takeaways:

  • Strong Consistency guarantees that every read receives the most recent data by synchronously updating all replicas. It provides predictability at the cost of higher latency and lower availability. It is essential for systems where data accuracy is paramount.
  • Eventual Consistency guarantees that data will become consistent over time by asynchronously updating replicas. It delivers high availability, low latency, and scalability at the cost of allowing temporary data staleness. It is the model of choice for many large-scale web applications.
  • The choice between these models represents a fundamental architectural trade-off between consistency and availability/performance.

Preview of the Next Lesson:

Having explored how data is stored and kept consistent, we will now turn our attention to how different parts of a cloud environment are connected. The next lesson will define key cloud networking components, such as Virtual Private Clouds (VPCs), Subnets, CDNs, and Load Balancers. These components are the glue that holds cloud services together and are critical for enabling the scalability and availability we have discussed.