DynamoDB 节流 [英] DynamoDB Throttling

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

问题描述

我有一个 5 读和 5 写容量的发电机表.在这张表中,我有两条记录.

I have a dynamo table with 5 read and 5 write capacity. In this table I had two records.

然后我决定通过一次推送大量写入(一次突发大约 4000 条记录)来查看我会得到什么样的错误响应.蓝色的消耗"线直接越过红色的容量"线,但我没有收到任何类型的错误消息.

I then decided to see what kind of error response I would get by pushing a large number of writes through at once (roughly 4000 records in one burst). The blue 'consumed' line shot straight over the red 'capacity' line however I got no error message of any kind.

指标显示正在发生限制,但如果我超过两个容量级别,我的读取和写入仍然会发生.

The metrics show throttling taking place but my reads still occur and my writes still occur if I go over both capacity levels.

我已经花费了 30 多分钟的时间将读取和写入远远超出容量,目前还没有错误.

I have spent over 30 minutes pushing the read and writes well above capacity, with no error yet.

我不确定这是不是因为我在 node js 中使用了官方的 javascript SDK,它可能透明地处理限制并重试限制查询?

I'm not sure if this is because I am using the official javascript SDK in node js, which maybe transparently handles throttling and retries the throttled queries?

我希望有人能给我一些指导.

I'm hoping somebody can give me some guidance on this.

谢谢

推荐答案

只是想在@Luc Hendriks 的答案中添加一个关于节流的通知

Just wanted to add a notice about throttling to the answer by @Luc Hendriks

即使在您用完突发容量"并且 DynamoDb 开始节流之后,您也会相对较少地收到 ProvisionedThroughputExceededException(根据我的经验).这是因为 SDK 静默重试受限制的请求(所以您是对的,SDK 透明地处理限制).

Even after you are out of 'burst capacity' and DynamoDb starts throttling, you will get ProvisionedThroughputExceededException relatively rarely (as per my experience). This is because SDK silently retries throttled requests (so you were right, SDK transparently handles throttling).

您可以使用 maxRetries 参数来禁用自动重试,这样您就会在看到指标受到限制后立即收到 ProvisionedThroughputExceededException.

You can use maxRetries parameter to disable automatic retries, so that you will get ProvisionedThroughputExceededException right after you see throttling in metrics.

这里是一个如何在不自动重试的情况下执行更新请求的示例:

Here is an example how to perform an update request without automatic retries:

var aws_dynamodb = new aws.DynamoDB({maxRetries: 0}),
    aws_dynamodb_doc = new aws.DynamoDB.DocumentClient({service: aws_dynamodb});

// ...
aws_dynamodb_doc.update(params, function(err, data) {
  // ...
});

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

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