DynamoDB 查询中如何计算消耗的读取容量单位 [英] How are consumed read capacity units calculated in DynamoDB query

查看:14
本文介绍了DynamoDB 查询中如何计算消耗的读取容量单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 amazon 上看过该页面,并了解 1 个 RCU 是一个 4KB 的项目.

I've seen the page on amazon and understand that 1 RCU is a 4KB item.

如果我有一个包含 50 个项目的表,我已经读过一次扫描将读取完整的 50 个项目并使用 50 个 RCU.但是假设我做了一个查询,我的表是 10 x 5,它还会使用 50 RCU 吗?

If I have a table with 50 items, I've read that a scan will read the full 50 items and use 50 RCU. But lets say I did a query, my table is 10 by 5, will it still use 50 RCU?

推荐答案

仅当 50 个项目的总大小等于 200KB(对于强一致性读取,或 400KB最终一致的读取).大多数项目并没有那么大,因此 50 个项目通常只需要大约 10KB 来存储,这意味着对 50 个项目的表进行完整扫描,最终保持一致性,只需要大约 3 个 RCU.

Scanning a table that contains 50 items will consume 50 RCU only if the total size of the 50 items combined equal 200KB (for a strongly consistent read, or 400KB for an eventual consistent read). Most items are not that big, so a 50 items typically only require about 10KB to store meaning a full scan for a table of 50 items, with eventual consistency, would only cost about 3 RCU.

消耗的读取容量单位 (RCU) 取决于多种因素:

The consumed Read Capacity Units (RCU) depends on multiple factors:

如果使用 GetItem 操作读取项目,则根据项目的大小(即 200B 项目和 3KB 项目将分别消耗1RCU,而一个 5KB 的项目会消耗 2 个 RCU)

If an item is read using a GetItem operation than the consumed capacity is billed in increments of 4KB, based on the size of the item (ie. a 200B item and a 3KB item would each consume 1RCU, while a 5KB item would consume 2 RCU)

如果您使用 QueryScan 操作读取多个项目,则消耗的容量取决于被访问项目的累积大小(即使是在使用过滤器时从查询或扫描中过滤出来的项目也会被收费).因此,如果您的查询或扫描访问 10 个项目,每个项目大小约为 200 字节,那么它将仅消耗 1 个 RCU.如果你读了 10 条,但每条的大小约为 5KB,那么总消耗的容量将是 13 个 RCU(50KB/4KB = 12.5,四舍五入为 13)

If you read multiple items using a Query or Scan operation, then the capacity consumed depends on the cumulative size of items being accessed (you get billed even for items filtered out of a query or scan when using filters). So, if your query or scan accesses 10 items, that are approximately 200 bytes each in size, then it will consume only 1 RCU. If you read 10 items but each item is about 5KB in size, then the total consumed capacity will be 13 RCU (50KB / 4KB = 12.5, rounded up, is 13)

更重要的是,如果您执行最终的一致性读取,那么您可以将每个容量单位的大小翻倍.所以读取这 10 个 5KB 的项目只需要 7 个 RCU.

What's more, if you perform an eventual consistent read, then you can double the size per capacity unit. So it would only cost 7 RCU to read the 10 5KB items.

您可以在此处阅读更多关于吞吐量的信息.

有几点需要注意:

  • 单个项目可能高达 400KB,因此读取一个项目可能会消耗多达 100 个 RCU.
  • 在计算项目大小时,属性名称也计入项目大小,而不仅仅是它们的值!

这篇关于DynamoDB 查询中如何计算消耗的读取容量单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆