简体   繁体   English

Dynamodb 什么是 WCU 和 RCU?

[英]Dynamodb what are WCU and RCU?

Even after reading many articles, I'm still unable to understand what WCU and RCU mean.看了很多文章,还是搞不懂WCU和RCU是什么意思。 Dynamo offers the following FREE tier: Dynamo 提供以下免费套餐:

  • 25 provisioned Write Capacity Units (WCU) 25 个预置写入容量单元 (WCU)
  • 25 provisioned Read Capacity Units (RCU) 25 个预置读取容量单元 (RCU)

What does "25 reads and writes per second" mean? “每秒 25 次读写”是什么意思? I have a web application with an API that reads from Dynamo.我有一个 web 应用程序和一个从 Dynamo 读取的 API。 Does that mean it can only handle 25 queries and writes per second?这是否意味着它每秒只能处理 25 个查询和写入? If yes, what happens if we get 26 read requests in one second?如果是,如果我们在一秒钟内收到 26 个读取请求会怎样?

I'm confused and would appreciate an explanation with a real-world example using a web application.我很困惑,希望能得到一个使用 web 应用程序的真实示例的解释。

As you said, RCU and WCU measures the number of reads and writes (respectively) per second.正如您所说,RCU 和 WCU 测量每秒读取和写入(分别)的次数。 However, for obvious reasons, doing a 10 byte read is not billed the same as a read of the entire database - one RCU is a read of up to 4KB, and larger reads are counted as multiple reads.然而,出于显而易见的原因,执行 10 字节读取与读取整个数据库的计费不同——一个 RCU 最多读取 4KB,更大的读取计为多次读取。 WCU uses a smaller quantum (1KB). WCU 使用较小的量程 (1KB)。 Another thing you should know is that an eventual consistency read counts as half a RCU, and a transactional read counts as two RCUs.您应该知道的另一件事是,最终一致性读取计为半个 RCU,事务读取计为两个 RCU。 See for example this source .例如,请参阅此来源

Your next question is what happens if you provision (ie, use "Provisioned" billing mode) 25 RCUs, but then try to make 26 requests per second.您的下一个问题是,如果您提供(即,使用“已提供”计费模式)25 个 RCU,然后尝试每秒发出 26 个请求,会发生什么情况。 Well, first of all, 25 is not a hard per-second limit but an average limit.好吧,首先,25 不是每秒的硬性限制,而是平均限制。 Amazon will let you use 50 RCUs in one second if you used 0 RCUs in the previous second.如果你在前一秒使用了 0 个 RCU,亚马逊会让你在一秒内使用 50 个 RCU。 The details of how exactly this averaging happens and what its period is isn't public, but it is known that in the past Amazon got complaints that people were paying for 25 RCUs and weren't getting 25,000 reads over 1000 seconds, and they acted on these complaints and now you should be able to get 25 reads per second on a long-term average.关于这种平均发生的细节以及它的周期是多少并没有公开,但众所周知,亚马逊过去曾收到投诉,称人们为 25 个 RCU 付费,但在 1000 秒内没有获得 25,000 次阅读,他们采取了行动根据这些投诉,现在您应该能够长期平均每秒读取 25 次。

Now, to return to your question what happens if you consistently try to send 26 reads per second with just 25 provisioned RCUs, well, some of your requests will fail with ProvisionedThroughputExceededException .现在,回到您的问题,如果您始终尝试仅使用 25 个已配置的 RCU 每秒发送 26 次读取,那么您的一些请求将因ProvisionedThroughputExceededException而失败。 Amazon's client libraries will, in such a case, automatically back of and retry the request.在这种情况下,Amazon 的客户端库将自动返回并重试请求。 So if you're using such a library, it will appear to you like your requests are slowing down until you're getting exactly 25 responses per second, and all requests succeed.因此,如果您使用这样的库,在您看来您的请求会变慢,直到您每秒收到恰好 25 个响应,并且所有请求都会成功。 This is also explained in the same link I gave above.这也在我上面给出的同一链接中进行了解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM