Question

Difficulty: MediumResolving DynamoDB Throttling and Key Distribution Issues

A developer is troubleshooting an application named PagePublish that stores metadata for online articles in an Amazon DynamoDB table. The table is configured with provisioned read capacity and uses ArticleStatus (such as DRAFT or PUBLISHED) as the partition key. During peak traffic hours, users experience high latency, and the application logs show numerous ProvisionedThroughputExceededException errors. Upon reviewing CloudWatch metrics, the developer notes that the read capacity is heavily consumed on a single partition, while other partitions remain idle. Which of the following is the most effective way to resolve this issue and prevent future throttling?

  1. A
    Increase the provisioned Read Capacity Units (RCUs) for the table to handle the traffic spikes during peak hours.
  2. B
    Modify the application to perform a Scan operation instead of a Query, and apply a filter expression on the client side to retrieve the articles.
  3. Redesign the table schema to use a more granular attribute, such as ArticleID, as the partition key.Answer
  4. D
    Increase the visibility timeout of the Amazon SQS queue that processes retrieval requests to give the table more time to process requests.

Answer

Redesign the table schema to use a more granular attribute, such as ArticleID, as the partition key.
Redesigning the table schema to use a more granular attribute like ArticleID ensures that write and read requests are evenly distributed across multiple physical partitions. Since DynamoDB allocates partition capacity based on the partition key value, high-cardinality keys prevent hot partitions and eliminate ProvisionedThroughputExceededException errors caused by uneven traffic distribution.

Step-by-Step Solution

1
Analyze the CloudWatch metrics and the exception logs.
Identify that the ProvisionedThroughputExceededException is occurring on a specific partition key value (ArticleStatus), indicating a hot partition issue.
Before applying a fix, the developer must determine if the throttling is due to overall capacity exhaustion or uneven key distribution.
2
Evaluate the cardinality of the partition key attribute.
Recognize that 'ArticleStatus' has very low cardinality (few distinct values like DRAFT or PUBLISHED), causing almost all requests to hit the same partition.
Understanding the key distribution characteristics is necessary to design a schema that distributes the workload evenly.
3
Select a partition key with high cardinality and modify the schema.
Choose a high-cardinality attribute like 'ArticleID' as the new partition key, which distributes read and write requests uniformly across partitions.
A high-cardinality partition key allows DynamoDB to partition the data across multiple physical SSDs, utilizing the provisioned throughput efficiently.

Key Concept

Resolving DynamoDB hot partitions by using a high-cardinality partition key design.
Estimated Time:1m 30s
Rate this question