DynamoDB interview question · Most asked

How do you calculate read and write capacity units?

Summary

One WCU writes one item of up to 1 KB per second; one RCU performs one strongly consistent read (or two eventually consistent reads) of up to 4 KB per second. Sizes round up, and transactional reads and writes cost twice as much.

Longer Answer

Examples:

  • Writing a 3.5 KB item: 4 WCU.
  • Strongly reading a 9 KB item: 3 RCU (9/4 rounded up). Eventually consistent: 1.5 RCU.
  • Query returning 40 items of 1 KB each: total 40 KB / 4 KB = 10 RCU strongly consistent (queries sum the sizes, then round up), 5 eventually consistent.
  • Each GSI adds write units for every write that touches it.

On-demand pricing uses request units with the same size rules. Small items and narrow projections save money.

Key Points

  • WCU: 1 KB writes; RCU: 4 KB reads.
  • Eventual reads cost half.
  • Transactions cost double.
  • GSIs add write cost.

More most-asked DynamoDB questions

← All DynamoDB questions