DVA-C02 Question 68
Single answerYou are developing a serverless application that uses Amazon DynamoDB to store user data. The application has a requirement to ensure consistent reads when fetching user profiles, as they are frequently updated. Additionally, you need to minimize latency when querying the database. Which of the following options should you implement?
- A
Use DynamoDB's strongly consistent reads when performing queries.
- B
Use DynamoDB's eventual consistent reads for better performance.
- C
Enable DynamoDB Accelerator (DAX) to reduce query latency and ensure consistency.
- D
Use the Scan operation instead of Query to fetch user profiles.
Show answer and explanation
Correct answer: A
Explanation
To meet the requirement of ensuring consistent reads while querying user profiles, you need to use DynamoDB's strongly consistent reads. By default, DynamoDB uses eventual consistency, which might not reflect the latest updates. While DAX can help reduce latency, it does not guarantee strong consistency, and Scan is not optimized for specific queries. Hence, using strongly consistent reads is the best choice.
- A. Correct.
This is the correct option. Strongly consistent reads ensure that when data is read from DynamoDB, you always get the latest data, meeting the application's requirement for consistency.
- B. Incorrect.
Eventual consistent reads do not guarantee up-to-date data, which means user profiles might not reflect the latest updates. This does not meet the requirement for consistency.
- C. Incorrect.
DynamoDB Accelerator (DAX) can reduce latency, but it does not provide strong consistency as it is a cache layer. Thus, it cannot guarantee the latest data.
- D. Incorrect.
The Scan operation is inefficient compared to the Query operation for fetching specific items or subsets of data. It also does not address the requirement for consistency or latency reduction.