DynamoDB和预置容量:节流与故障 [英] DynamoDB & Provisioned Capacity: Throttling vs. Failure

查看:252
本文介绍了DynamoDB和预置容量:节流与故障的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在这里阅读常见问题解答和其他文章,试图了解DynamoDB在读写容量单位方面的行为。假设我扫描了一张桌子,这超出了我的读取容量单位。我是否假设DynamoDB首先以较慢的方式限制请求并仍返回所有结果,这是正确的吗?在什么时候该请求将仅失败而不是受到限制?

I've been reading FAQs and other posts here, trying to understand DynamoDB's behavior with respect to read and write capacity units. Say I scan a table and this exceeds my read capacity units. Am I correct in assuming DynamoDB will throttle the request first, still returning all the results, just in slower fashion? At what point will the request simply fail, instead of being throttled?

推荐答案

如果您的请求超出了预配置的容量,您将收到 ProvisionedThroughputExceededException 错误。

If your request exceeds the provisioned capacity, you will receive a ProvisionedThroughputExceededException error.

错误处理文档说:


您的请求率太高。用于DynamoDB的AWS开发工具包自动重试请求,会收到此异常。您的请求最终将成功,除非重试队列太大而无法完成。使用指数补偿来减少请求的频率。

Your request rate is too high. The AWS SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the frequency of requests, using exponential backoff.

此外,请注意,DynamoDB提供了突发容量。摘录自使用表的准则文档:

Also, please note that DynamoDB provides Burst Capacity. From the Guidelines for Working with Tables documentation:


DynamoDB在按分区吞吐量配置中提供了灵活性。当您没有充分利用分区的吞吐量时,DynamoDB会保留部分未使用的容量,以供以后突发使用吞吐量。 DynamoDB当前保留最多五分钟(300秒)的未使用读写容量。在偶发的读写活动中,这些额外的容量单位可能会很快消耗掉,甚至比为表定义的每秒预配置吞吐量还快。但是,请不要设计您的应用程序,以使其始终取决于突发容量:DynamoDB可以并且确实将突发容量用于后台维护和其他任务,而无需事先通知。

DynamoDB provides some flexibility in the per-partition throughput provisioning. When you are not fully utilizing a partition's throughput, DynamoDB retains a portion of your unused capacity for later bursts of throughput usage. DynamoDB currently retains up to five minutes (300 seconds) of unused read and write capacity. During an occasional burst of read or write activity, these extra capacity units can be consumed very quickly—even faster than the per-second provisioned throughput capacity that you've defined for your table. However, do not design your application so that it depends on burst capacity being available at all times: DynamoDB can and does use burst capacity for background maintenance and other tasks without prior notice.

因此,自动重试和突发容量的组合意味着您不太可能收到吞吐量异常。如果您这样做,则将以指数方式退回并重试。

Thus, the combination of automatic retries plus burst capacity means that it is less-likely you will receive throughput exceptions. If you do, then exponentially back-off and retry.

某些DynamoDB用户维护一个Amazon SQS队列以临时存储事务。如果超过吞吐量,它们会将事务存储在SQS队列中。然后,后台进程从队列中检索事务,然后在希望有更多吞吐量可用时重试它们。

Some DynamoDB users maintain an Amazon SQS queue for temporary storage of transactions. If throughput is exceeded, they store the transaction in the SQS queue. Then, a background process retrieves the transactions from the queue and retries them later, when hopefully more throughput is available.

这篇关于DynamoDB和预置容量:节流与故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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