Thursday, October 23, 2025

AWS - Dynamo DB Eventual Vs Strong Consistency

 1. Eventually Consistent Reads (Default)

🔹 Definition:

When you perform a read immediately after a write, you may not get the latest data right away — but it will become consistent after a short delay (typically a fraction of a second).

🔹 Characteristics:
  • Low latency
  • Higher throughput (uses fewer read capacity units)
  • Suitable for most applications where data staleness of a few milliseconds is acceptable.

🔹 Use Case Example:

You’re displaying a product catalog on an e-commerce site where slight delay in updated inventory count is okay.


2. Strongly Consistent Reads

🔹 Definition:

When you request a strongly consistent read, DynamoDB returns the most up-to-date value — including all successful writes before the read.

🔹 Characteristics:

  • Higher latency than eventually consistent reads
  • Lower throughput (uses more read capacity units)
  • Guaranteed to return the latest data from a single region

🔹 Use Case Example:

Banking app displaying account balance immediately after a transaction.

🔐 Note: Strongly consistent reads are only supported in the same AWS region. Cross-region replication introduces eventual consistency.


Additional Concepts Related to Consistency:

🔸 Transactions:

  • DynamoDB supports ACID transactions, which ensure serializable isolation — the highest consistency level.
  • You can group multiple reads/writes to succeed or fail as a unit.

🔸 DynamoDB Global Tables:

  • Allow multi-region, active-active replication.
  • Eventually consistent by design across regions.
  • Great for high availability and low-latency access globally, but writes in one region may not be immediately visible in another.


Summary Table:

FeatureEventually ConsistentStrongly Consistent
Read LatencyLowerHigher
Read Capacity Usage0.5 units per KB1 unit per KB
Data Freshness GuaranteeNoYes (within region)
AvailabilityHigherSlightly Lower
Use CaseRead-most apps, low risk of stalenessCritical reads needing up-to-date data

No comments:

Post a Comment

Node | Cluster Vs Worker Threads

Cluster: Multiple processes (scale app across CPU cores) Worker Threads: Multiple threads (handle CPU-heavy work inside one process) Cluster...