gpt4 book ai didi

amazon-dynamodb - DynamoDB 为什么以及如何允许在扫描操作中使用超过分配的 RCU?

转载 作者:行者123 更新时间:2023-12-04 07:09:06 24 4
gpt4 key购买 nike

在做教程时,我将数据批量加载到我的 dynamoDB JobsApplication 表中,其中包含大约 400 个随机职位发布。

Here is how the table looks

使用 Node.jsaws-sdk 我执行了扫描操作。

var AWS = require('aws-sdk');
AWS.config.update({
region: 'us-east-1'
});
var print = require('./../lib/helpers').printPretty;
var dynamodb = new AWS.DynamoDB();

var epochNow = 1506043477;

var params = {
"TableName": "GMJS.Job",
"FilterExpression": "CountryId = :country AND ClosingTime > :time",
"ExpressionAttributeValues": {
":country": {
"S": "18"
},
":time": {
"N": epochNow.toString()
}
},
"ReturnConsumedCapacity": "TOTAL"
};

dynamodb.scan(params).promise()
.then(print)
.catch(print);

我的 table 目前分配有 5 个 RCU 和 WCU。扫描操作在不到 2 秒内给出了结果,除了结果还显示了以下信息:

"Count": 7,
"ScannedCount": 100,
"ConsumedCapacity": {
"TableName": "GMJS.Job",
"CapacityUnits": 89.5
}
}
Size of data: 50.8 KB

我已经关闭了自动缩放。那么当我只为表分配了 5 个 RCU 时,它是如何在 2 秒内消耗 89.5 个 RCUs 的呢?如果它必须消耗 89.5 个 RCUs,它可以每秒使用 5 个 RCUs,持续 17.9 秒,然后返回结果,或者它可以说该表需要更多的 RCUs 用于如此昂贵的扫描操作等。

那么当我只分配了 5 个 RCU 时,它如何使用 89.5 个 RCU 进行扫描是我的主要问题。

最佳答案

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.

Note

In the future, these details of burst capacity may change.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html#GuidelinesForTables.Bursting

关于amazon-dynamodb - DynamoDB 为什么以及如何允许在扫描操作中使用超过分配的 RCU?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49555497/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com