Databases & System Design•Part 3: NoSQL & Document Databases (MongoDB, DynamoDB) (26 - 40)
Eventual Consistency:
In Simple Words: In distributed stores, writes replicate asynchronously to secondary nodes. A read immediately after a write might briefly return stale data. Fix: Use Strongly Consistent Reads where critical.
typescript
// DynamoDB: Requesting strongly consistent read (costs 2x standard read):
const command = new GetItemCommand({
TableName: "Balances",
Key: { userId: { S: "user_99" } },
ConsistentRead: true // Forces read from primary storage node
});