2
votes

I was going over the AWS blog and from there the AWS re:Invent video to understand DynamoDB's concept of adaptive scaling and bursts. I understand the concept of WCU and RCU and the idea of burst buckets piling up to a period of 300 seconds and that the peak WCU/RCU of a partition is 1000/3000.

Starting time instant 23:00 of the video:

(1) The video gives an example of a table provisioned with 500 WCUs and 1500 RCUs. The table has 1 partition. The burst bucket after 5 minutes of "assumed" inactivity becomes 500*300=150K WCUs and 1500*300= 450K RCUs. And from there it is concluded that this table now with this burst bucket ready can offer up to 5 minutes of sustained 1K WCU or 3K RCU with one partition

How are we arriving at this figure of "up to 5 minutes of sustained 1K WCU or 3K RCU"? In my understanding this should have been the calculation for RCU: 450K/3K=150 seconds

(2) Further down, after the table splits into two partitions with the provisioned WCU/RCU getting evenly divided among the 2 partitions @250/750 respectively. With 2 partitions, the peak RCU doubles to 6K and peak WCU doubles to 2K and therefore they conclude that the same burst bucket now offers up to 100 seconds of sustained 2K WCU or 6K RCU with two partitions.

How are we arriving at this figure of "up to 100 seconds of sustained 2K WCU or 6K RCU"? In my understanding this should have been the calculation for RCU: 450K/6K=75 seconds

Any DynamoDB experts who could help derive this figure?

3

3 Answers

2
votes

up to 5 minutes of sustained 1K WCU or 3K RCU

The table can already sustain 500 WCU and 1500 RCU from its provisioned capacity alone. Only usage in excess of the table's provisioned capacity is consuming burst capacity. The table can sustain 500 WCU from provisioned + 500 WCU from burst = 1K WCU, for 300 seconds.

In the second scenario, the issue is the same. You're calculating 450000 ÷ 6000 but should be calculating 450000 ÷ (6000 - 1500) = 100 seconds, because burst capacity is consumed only at the rate of overage.

0
votes

Whenever you're not fully using a partition's throughput, DynamoDB reserves a portion of that unused capacity for later bursts of throughput to handle usage spikes.

DynamoDB currently retains up to 5 minutes (300 seconds) of unused read and write capacity.

Note that these burst capacity details might change in the future.

from https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-throughput-bursting

By way of an example, say I provision a minimal DDB with 1RCU.

The max capacity in my RCU bucket is 300 RCU-seconds. We know 1 RCU is equivalent of 2 reads of 4KB/s. Multiplying that by seconds means an RCU-second is actually 2 reads of 4KB.

We can use those 300 tokens (RCU-s) to read at the maximum speed allowed by our table and our partitions, 600 of 4KB items, 60 of 40KB item, 6 of 400KB items, or anything in between.

Amazon describe replenishment as a "portion" of unused capacity but it is really any "unused read and write capacity". Rick Houlihan says as much in https://www.youtube.com/watch?v=kMY0_m29YzU, to paraphrase, "if this table sat there unused for 5 minutes it would end up with 450k RCUs and 150k WCUs". In the tiny table I have illustrated, that is 1 RCU-s for every second it is idle.

-1
votes

(Total unused WCU/RCU saved for 5 minutes) / ((sustained WCU/RCU * number of partitions) - provisioned WCU/RCU )

Single Partition:

WCU: 15000/ ((1000*1) - 500) = 300 seconds

RCU: 45000/ ((3000*1) - 1500) = 300 seconds

Double Partion:

WCU : 15000 / ((1000*2) - 500) = 100 seconds

RCU : 45000 / ((3000 * 2) - 1500) = 100 seconds