DynamoDB throttling

0

I am wondering if I set write capacity to dynamodb and some of the requests got "throttled" , are they eventually entering the database later?

arpecop
질문됨 일 년 전1226회 조회
5개 답변
3

For your application to run smoothly, you need to add logic to catch and respond to errors. Typical approaches include using try-catch blocks or if-then statements.

The AWS SDKs perform their own retries and error checking. If you encounter an error while using one of the AWS SDKs, the error code and description can help you troubleshoot it.

Each AWS SDK implements retry logic automatically. You can modify the retry parameters to your needs. For example, consider a Java application that requires can only tolerate 3 retries. With the AWS SDK for Java, you could use the ClientConfiguration class and provide a maxRetries value of 3 to allow only 3 retries. For more information, see the AWS SDK documentation for your programming language.

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 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.

In summary, your SDK will automatically retry to a fixed number of times before throwing an exception which you can catch in a try/catch block. If no exceptions were thrown it means that your items were successfully persisted with one of the retries. Retries are configurable, each of the SDK's have a different default value, e.g Java SDK V1 uses 10 as default, and Java SDK V2 uses 8.

profile pictureAWS
전문가
답변함 일 년 전
1

, are they eventually entering the database later?

No, the application must retry.

Managing settings on DynamoDB provisioned capacity tables - Amazon DynamoDB

If your application performs reads or writes at a higher rate than your table can support, DynamoDB begins to throttle those requests. When DynamoDB throttles a read or write, it returns a ProvisionedThroughputExceededException to the caller. The application can then take appropriate action, such as waiting for a short interval before retrying the request.

profile picture
답변함 일 년 전
0

Hi, The short answer is no. If you exceed your Provisioned Write Capacity, you will start to get theProvisionedThroughputExceededException error.

Here is some more info on how to deal with throttling and how to deal with it.

From the docs ... https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html#HowItWorks.ProvisionedThroughput.Manual

Provisioned throughput is the maximum amount of capacity that an application can consume from a table or index. If your application exceeds your provisioned throughput capacity on a table or index, it is subject to request throttling.

Throttling prevents your application from consuming too many capacity units. When a request is throttled, it fails with an HTTP 400 code (Bad Request) and a ProvisionedThroughputExceededException. The AWS SDKs have built-in support for retrying throttled requests (see Error retries and exponential backoff), so you do not need to write this logic yourself.

profile pictureAWS
micah
답변함 일 년 전
0

Something to remember is that SDKs will retry internally some number of times if they see a throttle exception, so it's entirely possible that in CloudWatch you'll see throttling happening while at the same time everything seems to have been written and your application won't seem to notice any issues.

If the throttling is sustained long enough then the application will see the exception from the SDK call and at that point it needs to either do an explicit retry or else the write will not happen.

AWS
답변함 일 년 전
-1

No, you will have to increase the WCU or set your capacity mode to provisioned auto-scaling if you are unsure of the WCU to set.

profile picture
답변함 24일 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠