How to do it...

Follow these steps to calculate your DynamoDB capacity:

  1. Start with the size of the items, in Kilobytes (KB):

ItemSize = Size of the items (rows) in KB

  1. Work out the required number of RCUs required by dividing the number by 4 and rounding up:

RCU Per Item = ItemSize / 4 (rounded up)

  1. Define the expected number of reading operations per second. This is one of the numbers you will use to provision your table with:

Required RCU = Expected Number of Reads * RCU Per Item

  1. Divide the number by 3,000 to calculate the number of DDB partitions required to reach the capacity:

Read Partitions = Required RCU / 3,000

  1. Next, work out the write capacity required by dividing the item size by 1 and rounding up:

WCU Per Item = ItemSize / 1 (rounded up)

  1. Define the expected number of write operations per second. This is one of the numbers you will use to provision your table with:

Required WCU = Expected Number of Writes * WCU Per Item

  1. Divide the number by 1,000 to calculate the number of DDB partitions required to reach the capacity:

Write Partitions = Required WCU / 1,000

  1. Add these two values to get the capacity partitions required (rounding up to a whole number):

Capacity Partitions = Read Partitions + Write Partitions (rounded up)

  1. Work out the minimum number of partitions required by the amount of data you plan to store:

Size Partitions = Total Size in GB / 10 (rounded up)

  1. Once you have the partition requirements for your use case, take the maximum of your previous calculations:

Required Partitions = Maximum value between Capacity Partitions and Size Partitions

  1. Since your allocated capacity is spread evenly across partitions, divide the RCU and WCU values to get the per-partition performance of your table:

Partition Read Throughput = Required RCU / Required Partitions

Partition Write Throughput = Required WCU / Required Partitions

For example, let's say you have an item size of 3 KB. The RCU per item is 1 (3/4 rounded up). We expect 100 reads per second, so the expected RCUs are 100. The WCU per item is 3, and if we expect 20 writes per second, then the expected WCUs are 60. Since each of those is less than 1,000, we need two total partitions to handle the reads and writes. If we plan to store 1 billion items, then the number of partitions we expect is 286 (1 billion * 3 KB / 1024 / 1024 / 10). We choose the maximum between the capacity and the size, and we get 286.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset