AWS DynamoDB Throttled Write Request Handling

旧城冷巷雨未停 提交于 2021-01-28 07:11:21

问题


I have a table which has throttled write request at a specified time. I want to understand more about how AWS-SDK handle them.

For my current understanding, DynamoDB will return an error to my Lambda. That's why I will have user errors in DynamoDB Table Metrics. However, AWS-SDK has error-handling and retry strategy which helps me to retry and write the throttled requests back to the table. Is it correct?


回答1:


Every time your application sends a request that exceeds your capacity you get a ProvisionedThroughputExceededException message from Dynamo. However your SDK handles this for you and retries. The default Dynamo retry time starts at 50ms, the default number of retries is 10, and backoff is exponential by default.

This means you get retries at:

  1. 50ms
  2. 100ms
  3. 200ms
  4. 400ms
  5. 800ms
  6. 1.6s
  7. 3.2s
  8. 6.4s
  9. 12.8s
  10. 25.6s

If after the 10th retry your request has still not succeeded, the SDK passes the ProvisionedThroughputExceededException back to your application and you can handle it how you like.

Note that you can change the default retry behaviour of your SDK. For example

new AWS.DynamoDB({maxRetries: 13, retryDelayOptions: {base: 200}});

This would mean you retry 13 times, with an initial delay of 200ms. This would give your request a total of 819.2s to complete rather than 25.6s.




回答2:


If lot of write requests are coming to your dynamoDB table and provisioned write capacity is less the the write requests them DynamoDB throttles your request.

If you implement a retry strategy and use it for failed write than this write may also gets throttled as you are already receiving lot of write requests. This retry strategy will add extra load to your dynamoDB.

The solution for this is to use DynamoDB On-demand mode.



来源:https://stackoverflow.com/questions/55015113/aws-dynamodb-throttled-write-request-handling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!