Read and Write Capacity Modes in AWS DynamoDB

aws
Reading Time: 4 minutes

The read/write capacity modes for processing reads and writes on the tables determine AWS DynamoDB throughput capacity.

DynamoDB supports two types of read/write capacity modes:

  • Provisioned (default)
  • On-demand

Provisioned Mode

  • In provisioned mode, you must specify the number of reads and writes per second that the application requires.
  • Provisioned throughput is the maximum amount of capacity that an application can consume from a table or index
  • Can use auto-scaling to adjust your table’s provisioned capacity automatically in response to traffic changes. 

If you want to use provisioned mode, it’s a good choice when you :

  • Have predictable application traffic.
  • Run applications whose traffic is consistent or ramps gradually.
  • Can forecast capacity requirements to control costs.

The Read Capacity of a DynamoDB table shows us how much data can be read. It is measured in RCUs.

Read Capacity Units (RCU)

  • 1 RCU = 1 highly consistent read up to 4 KB/s = 2 gradually consistent reads up to 4 KB/s each read
  • For items up to 4 KB, 2 RCUs = 1 transactional read request (one read per second).
  • The total number of reads necessary for things larger than 4 KB = (total item size / 4 KB) rounded up.

For example, if your item size is 8 KB, you will need 2 read capacity units to maintain one strongly consistent read per second,

1 read capacity unit if you choose eventually consistent reads,

and 4 read capacity units if you request a transactional read.

The DynamoDB Write Capacity parameter indicates how much data can be written to a DynamoDB table. It is measured in WCUs.

Write Capacity Units (WCU)

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

For example, if your item is 2 KB in size, you’ll need 2 write capacity units to support one write request per second,

and 4 write capacity units for a transactional write request.

On-demand Mode

  • Without capacity planning, the on-demand mode gives a flexible charging option capable of processing thousands of requests per second.
  • The expected read and write throughput does not need to be specified.
  • In terms of read request units and write request units, only the reads and writes that the program performs on the tables are charged.

If you want to use on-demand, it’s a good choice when you :

  • Make new tables with unidentified workloads.
  • Have unpredictable application traffic.
  • Prefer the ease of paying for only what you use.

Read Request Units (RRU)

  • 1 RRU = 1 strongly consistent read at up to 4 KB/s = 2 ultimately consistent reads at up to 4 KB/s each read
  • For items up to 4 KB, 2 RRUs = 1 transactional read request (one read per second).
  • A total number of reads necessary for things larger than 4 KB = (total item size / 4 KB) rounded up.

For example, if your item size is 8 KB, you will need 2 read request units to sustain one strongly consistent read,

1 read request unit if you pick ultimately consistent reads,

and 4 read request units if you choose transactional reads.

Write Request Units (WRU)

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

For example, if your item is 2 KB in size, you’ll need 2 write request units to support one write request,

and 4 write request units to support a transactional write request.

Reference

Click Here