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.

There are two read/write capacity modes that DynamoDB supports:

  • Provisioned (default)
  • On-demand

Provisioned Mode

  • In provisioned mode, we must specify the number of reads and writes per second that the application requires.
  • Provisioned throughput is the most storage capacity a table or index will let an application to use.
  • Can utilize auto-scaling to automatically update the provisioned capacity of our table in response to changes in traffic.

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

  • Have predictable application traffic.
  • Run applications whose traffic is steady or steadily increases.
  • 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 our item size is 8 KB, we will need 2 read capacity units to maintain one strongly consistent read per second,

one read capacity unit if we select eventually consistent reads,

and four read capacity units if we 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 our item is 2 KB in size, we’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 we want to use on-demand, it’s a good choice when :

  • Make new tables with unidentified workloads.
  • Have unpredictable application traffic.
  • Prefer the flexibility of only paying for 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 our item size is 8 KB, you will need 2 read request units to sustain one strongly consistent read,

1 read request unit if we pick ultimately consistent reads,

and 4 read request units if we select 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 our item is 2 KB in size, we’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

Click Here

Written by 

I am a software Consultant at knoldus Inc in the DevOps studio. I am always excited to learn new things and upskill myself.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading