Which statement best describes the difference between strongly consistent reads and eventually consistent reads in DynamoDB?
Think about which read type prioritizes data freshness over speed.
Strongly consistent reads always return the latest committed data, ensuring freshness. Eventually consistent reads may return stale data but are faster and consume fewer resources.
Suppose you update an item in DynamoDB and immediately perform an eventually consistent read on that item. What is the most likely result?
Consider the delay in data propagation for eventually consistent reads.
Eventually consistent reads may return stale data immediately after an update because the changes might not have propagated to all storage locations yet.
Which of the following code snippets correctly performs a strongly consistent read using the AWS SDK for DynamoDB?
const params = {
TableName: 'Users',
Key: { 'UserId': '123' },
ConsistentRead: true
};
const data = await dynamodb.getItem(params).promise();Check the official AWS SDK parameter names for consistency.
The parameter to request a strongly consistent read is ConsistentRead: true. Setting it to false or using other parameters is incorrect.
You have a DynamoDB table with frequent updates and many read requests. You want to minimize read latency and cost but can tolerate slightly stale data. Which read consistency option should you choose?
Think about trade-offs between cost, latency, and data freshness.
Eventually consistent reads are cheaper and faster but may return stale data. This fits the requirement of tolerating slight staleness to optimize cost and latency.
A developer notices that after updating an item, a read immediately following the update sometimes returns old data. The read uses ConsistentRead: true. What is the most likely cause?
Consider how global secondary indexes handle consistency.
Global secondary indexes in DynamoDB are eventually consistent by default. Even if the main table read is strongly consistent, reading from an index can return stale data.