Troubleshooting ProvisionedThroughputExceededException in DynamoDB

Overcoming ProvisionedThroughputExceededException in DynamoDB

Prev Question Next Question

Question

You have been asked to troubleshoot a serverless application that is occasionally throwing errors while storing payment transaction details.

The application is using DynamoDB as its database.

Upon actively looking at the application logs, you see ProvisionedThroughputExceededException as an error against each timestamp application unable to serve the request successfully.

Which of the following combinations of steps would work to overcome this problem? (Select TWO)

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: B and D.

Numerous components on a network, such as DNS servers, switches, load balancers, and others, can generate errors anywhere in the life of a given request.

The usual technique for dealing with these error responses in a networked environment is to implement retries in the client application.

Each AWS SDK implements retry logic automatically.

You can modify the retry parameters to your needs.

In addition to simple retries, each AWS SDK implements an exponential backoff algorithm for better flow control.

The concept behind exponential backoff is to use progressively longer waits between retries for consecutive error responses.

For example, up to 50 milliseconds before the first retry, up to 100 milliseconds before the second, up to 200 milliseconds before the third, and so on.

However, after a minute, if the request has not succeeded, the problem might be the request size exceeding your provisioned throughput, and not the request rate.

Set the maximum number of retries to stop around one minute.

If the request is not successful, investigate your provisioned throughput options.

Option A is incorrect: This is not practically feasible and involves overhead in implementation.

Hence, this is not the best practice.

Option C is incorrect: Mere increasing RCUs and WCUs every time you receive this error is not an optimal solution.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html#Programming.Errors.RetryAndBackoff

The ProvisionedThroughputExceededException error in DynamoDB indicates that the number of read or write requests to a table exceeds its provisioned throughput capacity. This error may occur if the application is making too many requests at once or if the table's provisioned capacity is too low.

To overcome this problem, we can take the following steps:

  1. Use Exponential Backoff Algorithm: When the application receives a ProvisionedThroughputExceededException error, it should wait for a random amount of time before retrying the request. This wait time should increase exponentially with each retry attempt, using a backoff algorithm. Exponential backoff helps prevent the application from flooding the table with requests and potentially exhausting its provisioned capacity.

  2. Increase RCUs and WCUs: If the application is regularly exceeding the table's provisioned capacity, it may be necessary to increase the number of read and write capacity units (RCUs and WCUs) assigned to the table. This will allow the table to handle more requests per second. The number of RCUs and WCUs should be increased gradually to avoid sudden spikes in traffic.

Options A and D are not relevant to the problem at hand. Creating a new table would not address the issue of the table's provisioned capacity being exceeded, and using the AWS SDK is not a solution in itself.

Therefore, the correct answers to the question are B and C.