DynamoDB节流 [英] DynamoDB Throttling

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

问题描述

我有一个具有5个读取和5个写入容量的发电机表。在此表中,我有两条记录。



然后,我决定查看一下一次推送大量写入(大约4000条记录)会得到什么样的错误响应。一口气)。蓝色的已消耗线直接越过红色的容量线,但是我没有任何错误消息。



指标显示节流正在发生,但我的读数仍然在如果我同时达到两个容量级别,则会发生写入,并且仍会发生写入。



我花了30多分钟的时间将读取和写入操作大大超过容量,但没有错误。 / p>

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



我希望有人能对此提供一些指导。



谢谢

解决方案

只想在@Luc Hendriks的答案中添加有关节流的通知



突发容量和DynamoDb开始节流,您会相对很少地获得ProvisionedThroughputExceededException(根据我的经验)。这是因为SDK默默地重试了受限制的请求(所以您说对了,SDK透明地处理了限制)。



您可以使用 maxRetries 参数可禁用自动重试,以便在看到度量标准出现限制后立即获得ProvisionedThroughputExceededException。



下面是一个示例无需自动重试即可执行更新请求:

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

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


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

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.

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

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.

Thanks

解决方案

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

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

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天全站免登陆