Home > Enterprise >  Dynamodb what are WCU and RCU?
Dynamodb what are WCU and RCU?

Time:03-22

Even after reading many articles, I'm still unable to understand what WCU and RCU mean. Dynamo offers the following FREE tier:

  • 25 provisioned Write Capacity Units (WCU)
  • 25 provisioned Read Capacity Units (RCU)

What does "25 reads and writes per second" mean? I have a web application with an API that reads from Dynamo. Does that mean it can only handle 25 queries and writes per second? If yes, what happens if we get 26 read requests in one second?

I'm confused and would appreciate an explanation with a real-world example using a web application.

CodePudding user response:

As you said, RCU and WCU measures the number of reads and writes (respectively) per second. 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. WCU uses a smaller quantum (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. See for example this source.

Your next question is what happens if you provision (i.e., use "Provisioned" billing mode) 25 RCUs, but then try to make 26 requests per second. Well, first of all, 25 is not a hard per-second limit but an average limit. Amazon will let you use 50 RCUs in one second if you used 0 RCUs in the previous second. 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.

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. Amazon's client libraries will, in such a case, automatically back of and retry the request. 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. This is also explained in the same link I gave above.

  • Related