AWS DynamoDB受限制的写请求处理 [英] AWS DynamoDB Throttled Write Request Handling

查看:203
本文介绍了AWS DynamoDB受限制的写请求处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,该表在指定时间限制了写请求.我想了解更多有关AWS-SDK如何处理它们的信息.

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

就我目前的理解而言,DynamoDB将向我的Lambda返回一个错误.这就是为什么在DynamoDB表指标中会出现用户错误的原因.但是,AWS-SDK具有错误处理和重试策略,可帮助我重试并将受限制的请求写回到表中.正确吗?

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?

推荐答案

每当您的应用程序发送的请求超出您的能力时,您都会从Dynamo收到一条 ProvisionedThroughputExceededException 消息.但是,您的SDK会为您处理此问题,然后重试.Dynamo的默认重试时间开始于50ms,默认重试次数为10,默认情况下,补偿是指数级的.

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.4秒
  9. 12.8秒
  10. 25.6秒

如果在第10次重试后您的请求仍未成功,则SDK将 ProvisionedThroughputExceededException 传递回您的应用程序,您可以按照自己的意愿进行处理.

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.

请注意,您可以更改SDK的默认重试行为.例如

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

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

这意味着您重试13次,初始延迟为200ms.这将使您的请求总共需要819.2秒而不是25.6秒才能完成.

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.

这篇关于AWS DynamoDB受限制的写请求处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆