为 dynamoDB 的小对象计算 RCU

Calculating RCUs for small objects for dynamoDBs

假设我们有一个 table,平均项目大小为 1 KB。我们执行一个查询,读取 3 个这样的项目。现在根据我所读到的,RCU 的数量应该是(强一致性读取): (读取的项目数)* ceil(item_size/4) = 3 * ceil(1/4) = 3*1 = 3.

所以想确认:这是正确的吗?或者我们是否使用单个 RCU,因为读取的消息总大小为 3,小于 4。

RCU 适用于 1 次高达 4KB 的强一致性读取。

因此您可以为 1 个 RCU 查询 () 四个 1KB 项目。

因为你只有3个要读,所以会消耗1个RCU。

使用 GetItem() 获取同样的 3 条记录将花费 3 个 RCU。

假设您有 100 个项目与 (HK+SK) 查询匹配,但您还使用过滤器进一步返回 select 条记录;所以你只得到 4 条记录。该查询将占用 25 个 RCU,因为即使没有返回记录,仍然需要读取记录。

可以找到参考 here :

Query—Reads multiple items that have the same partition key value. All items returned are treated as a single read operation, where DynamoDB computes the total size of all items and then rounds up to the next 4 KB boundary. For example, suppose your query returns 10 items whose combined size is 40.8 KB. DynamoDB rounds the item size for the operation to 44 KB. If a query returns 1500 items of 64 bytes each, the cumulative size is 96 KB.