DynamoDB 中的读取吞吐量

Read throughput in DynamoDB

好的,所以我对读取单元的理解是每个项目花费 1 个读取单元,除非项目超过 4KB,在这种情况下读取单元 = ceiling(item size/4).

然而,当我提交要求 80 个项目的扫描(预置吞吐量为 100)时,响应 returns 2.5 或 3 个读取单元的 ConsumedCapacity。这令人沮丧,因为 97% 的配置硬件未被使用。知道为什么会这样吗?

这 80 件商品的商品尺寸是多少?查看此处的文档:http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ProvisionedThroughputIntro.html

You can use the Query and Scan operations in DynamoDB to retrieve multiple consecutive items from a table in a single request. With these operations, DynamoDB uses the cumulative size of the processed items to calculate provisioned throughput. For example, if a Query operation retrieves 100 items that are 1 KB each, the read capacity calculation is not (100 × 4 KB) = 100 read capacity units, as if those items were retrieved individually using GetItem or BatchGetItem. Instead, the total would be only 25 read capacity units ((100 * 1024 bytes) = 100 KB, which is then divided by 4 KB).

因此,如果您的项目很小,这就可以解释为什么扫描没有像您预期的那样消耗那么多的容量。另外,请注意 Scan 使用最终一致性读取,这会消耗一半的读取容量单位。