Question

Difficulty: Very hardOptimizing Performance with Caching and DAX

An e-commerce platform uses an Amazon DynamoDB table to store product inventory details. During flash sales, the application experiences a massive surge in read requests, resulting in intermittent ProvisionedThroughputExceededException errors. To reduce read latency to sub-milliseconds, the developer integrates an Amazon DynamoDB Accelerator (DAX) cluster. However, the developer notices that several critical inventory check operations, which must retrieve the most up-to-date quantities using strongly consistent reads, continue to suffer from high latency and still trigger throttling on the underlying DynamoDB table. Additionally, some reporting scripts perform full scans of the inventory and are also experiencing performance issues. Which of the following is the most appropriate explanation and resolution for this behavior?

  1. A
    The application's IAM execution role lacks the dax:GetItem permission, causing the DAX client to fail open and default to standard DynamoDB calls. To resolve this, update the IAM policy and adjust the Lambda function's timeout configuration to prevent execution contexts from being prematurely terminated during spikes.
  2. B
    The DAX cluster is experiencing throttling because the inventory check queries are hitting a hot partition key that exceeds the DAX node capacity. To resolve this, scale up the provisioned write capacity of the underlying DynamoDB table and keep using Scan operations to distribute the read load evenly across all partitions.
  3. Strongly consistent reads are not cached by DAX and are passed directly through to the DynamoDB table, consuming provisioned read throughput. To resolve the throttling and latency, modify the inventory checks to use eventually consistent reads so they are served from the DAX item cache, and rewrite the reporting scripts to retrieve items using Query operations instead of Scan operations.Answer
  4. D
    Strongly consistent reads bypass the DAX cache only if they are executed within a DynamoDB transaction. To resolve this, wrap the inventory checks in a TransactGetItems API call and configure the reporting scripts to execute Scan operations with a smaller Limit parameter to prevent ProvisionedThroughputExceededException.

Answer

Strongly consistent reads are not cached by DAX and are passed directly through to the DynamoDB table, consuming provisioned read throughput. To resolve the throttling and latency, modify the inventory checks to use eventually consistent reads so they are served from the DAX item cache, and rewrite the reporting scripts to retrieve items using Query operations instead of Scan operations.
Strongly consistent reads are not cached by DAX and are passed directly through to the underlying DynamoDB table, which consumes read capacity units (RCUs) and can lead to throttling. Modifying the read operations to use eventual consistency allows DAX to serve these requests from the item cache, significantly reducing latency and protecting the DynamoDB table from throttling. Additionally, rewriting full table scans to use Query operations targets specific partition keys, reducing read capacity usage.

Step-by-Step Solution

1
Analyze how DAX handles strongly consistent reads vs eventually consistent reads.
DAX does not cache strongly consistent reads; it passes them directly to DynamoDB, consuming Provisioned Throughput.
To determine why the inventory checks bypass the DAX cluster and hit DynamoDB.
2
Identify the caching solution for read operations.
Change the inventory check reads from strongly consistent to eventually consistent.
Eventually consistent reads are cached in the DAX item cache, lowering latency and removing load from DynamoDB.
3
Evaluate the reporting scripts' data retrieval strategy.
Replace Scan operations with targeted Query operations.
Scan operations retrieve all items in a table, whereas Query operations search using partition key attributes, significantly reducing RCU consumption.

Key Concept

DAX Caching Behavior and Read Consistency
Rate this question