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

Why and how does DynamoDB allows consuming more than allotted RCUs in Scan Operation?

在做教程时,我将数据批量加载到我的 dynamoDB JobsApplication table 大约 400 个随机职位帖子。

使用 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 RCUs 给 table 时,它是如何在 2 秒内消耗 89.5 RCUs 的?如果它必须消耗 89.5 RCUs,它可以每秒使用 5 RCUs,持续 17.9 秒,然后返回结果,或者它可以说 table 需要更多 RCUs如此昂贵的扫描操作等

所以当我只分配 5 RCUs 时它是如何使用 89.5 RCUs 进行扫描的是我的主要问题。

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