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:
| Feature | Eventually Consistent | Strongly Consistent |
|---|---|---|
| Read Latency | Lower | Higher |
| Read Capacity Usage | 0.5 units per KB | 1 unit per KB |
| Data Freshness Guarantee | No | Yes (within region) |
| Availability | Higher | Slightly Lower |
| Use Case | Read-most apps, low risk of staleness | Critical reads needing up-to-date data |
No comments:
Post a Comment