Calculating WCU and RCU for AWS DynamoDB

Home » Amazon Web Services » Calculating WCU and RCU for AWS DynamoDB
AWS DynamoDB WCU and RCU

DynamoDB is a pivotal part of the AWS ecosystem, and understanding how it works can be a tremendous aid to your organization’s cloud deployments. 

The key to understanding billing – in particular when using DynamoDB – is to understand how reads and writes to the database are measured, and how this reflects the final bill you pay. There are a number of caveats to understanding this – such as the type of DynamoDB table you provision, and the frequency of access. However, the reads and writes are ultimately measured with Read Capacity Units (RCUs) and Write Capacity Units (WCUs).

The definition is as follows:

  • Read Capacity units: One strongly consistent read or two eventually consistent reads for a data block of up to 4 KB.
  • Write capacity units: One write request for a data block of up to 1 KB.

There are two different modes in which you can provision your DynamoDB table: On Demand mode and Provisioned mode.

On-Demand Mode vs Provisioned Mode

On-demand capacity charges are based on how many read/write units the application consumes throughout the month, while Provisioned Capacity fees are based on how much capacity the developer allocates. The usage of this capacity is billed hourly, regardless of how much of it was consumed. When the application exceeds the provisioned capacity, AWS throttles the requests, and the application will not be able to read or write data.

On-demand mode tables don’t require you to specify the read throughput your application will achieve.

Read Capacity Units [On-Demand Mode]

In DynamoDB, read request units are used to measure how many reads your application performs on your tables:

  • 1 Read Request Unit (RRU) = 1 strongly consistent read of up to 4 KB/s = 2 eventually consistent reads of up to 4 KB/s per read.
  • 2 RRUs = 1 transactional read request (one read per second) for items up to 4 KB.
  • For reads on items greater than 4 KB, total number of reads required = (total item size / 4 KB) rounded up.

You specify the number of reads and writes you require per second if you choose provisioned mode. When traffic changes, auto scaling automatically adjusts your table’s provisioned capacity.

Read Capacity Units [Provisioned Mode]

For provisioned mode tables, you specify throughput capacity in terms of read capacity units (RCUs), as discussed earlier:

  • 1 Read Capacity Unit (RCU) =  1 strongly consistent read of up to 4 KB/s = 2 eventually consistent reads of up to 4 KB/s per read.
  • 2 RCUs = 1 transactional read request (one read per second) for items up to 4 KB.
  • For reads on items greater than 4 KB, total number of reads required = (total item size / 4 KB) rounded up.

Write Capacity Units however, are calculated slightly differently.

Write Capacity Units [On-Demand Mode]

You do not have to specify the write throughput that your application expects for on-demand mode tables. Your application is charged for the write requests it makes to your tables by DynamoDB.

  • 1 Write Request Unit (WRU) = 1 write of up to 1 KB/s.
  • 2 WRUs = 1 transactional write request (one write per second) for items up to 1 KB.
  • For writes greater than 1 KB, total number of writes required = (total item size / 1 KB) rounded up

Write Capacity Units [Provisioned Mode]

For provisioned mode tables, you also specify throughput capacity in terms of write capacity units (WCUs):

  • 1 Write Capacity Unit (WCU) = 1 write of up to 1 KB/s.
  • 2 WCUs = 1 transactional write request (one write per second) for items up to 1 KB.
  • For writes greater than 1 KB, total number of writes required = (total item size / 1 KB) rounded up

Hopefully, this blog post has been useful in helping you understand how to calculate DynamoDB RCUs and WCUs, depending on whichever DynamoDB mode you are using.

Learn how to Master the AWS Cloud

AWS Training – Our popular AWS training will maximize your chances of passing your AWS certification the first time.
Membership – For unlimited access to our entire cloud training catalog, enroll in our monthly or annual membership program.
Challenge Labs – Build hands-on cloud skills in a secure sandbox environment. Learn, build, test and fail forward without risking unexpected cloud bills.

Related posts:

Responses

Your email address will not be published. Required fields are marked *