DynamoDB Throttling(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 节流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:DynamoDB 节流
基础教程推荐
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01