Question

Difficulty: MediumResolving DynamoDB Throttling and Key Distribution Issues

A sports streaming application named FanStream logs viewer chat messages during live events. The chat messages are written to an Amazon DynamoDB table with EventID as the partition key and Timestamp as the sort key. During highly anticipated matches, the application experiences frequent ProvisionedThroughputExceededException errors on write operations, even though the total consumed write throughput is well below the table's provisioned capacity. Which of the following actions should the developer take to resolve this issue? (Select TWO.)

  1. Append a random suffix to the EventID partition key value before writing the items to distribute the write requests across multiple physical partitions.Answer
  2. Configure the AWS SDK client to utilize exponential backoff and jitter when retrying throttled requests.Answer
  3. C
    Increase the visibility timeout of the upstream Amazon SQS queue that processes the incoming write requests.
  4. D
    Retrieve records using a Scan operation with a filter expression instead of using a Query.
  5. E
    Hardcode permanent AWS access keys directly in the application configuration to eliminate IAM metadata service query latency.

Answer

To resolve the write throttling and key distribution issues, the developer should append a random suffix to the partition key (EventID) to distribute writes across partitions, and configure the AWS SDK client to use exponential backoff and jitter for retrying failed requests.
The correct options involve appending a random suffix to the partition key (which shards the hot partition key to distribute write traffic across physical partitions) and configuring the AWS SDK with exponential backoff and jitter (which prevents retry storms by spacing out requests and handling transient throttling gracefully).

Step-by-Step Solution

1
Analyze the table key design and throttling error.
Identify that the partition key (EventID) has high write concurrency during matches, concentrating all writes onto a single logical partition (a hot key scenario), causing ProvisionedThroughputExceededException.
DynamoDB allocates capacity across physical partitions based on partition keys. Concentrating traffic on a single key leads to throttling even if the total provisioned throughput is not exceeded.
2
Select a strategy to distribute the write load.
Append a random suffix (e.g., EventID_1, EventID_2) to the partition key to split the writes across multiple logical partitions.
This key sharding strategy ensures write operations are evenly distributed, avoiding the limits of a single partition.
3
Implement a retry policy to handle transient spikes.
Configure the AWS SDK with exponential backoff and jitter.
This mitigates temporary spikes by spacing out retry attempts, avoiding a thundering herd problem where all retries hit the table at the same time.

Key Concept

Resolving hot partitions and throttling in DynamoDB
Rate this question