praj hegde
praj hegde

Reputation: 15

Query on DynamoDB Provisioned Throughput WCU/RCU operation

I am trying to understand how dynamo DB provisioned throughput (RCU/WCU) works.

I tried 2 scenarios where i made a change in WCU ( 1,000 & 10,000), but the WCU consumed figures which i am getting is same i.e. 809.63.

In a nutshell, i have 123 records distributed in 5 files, each record is of 400 KB ( according to dynamo db limit rule). When executing these cases there was no throttling, and strange thing is script execution time is same i.e. 6 sec, even though i have changed WCU count to 1k & 10k respectively.

My question is why does it behave like this. I would like to know your comments on this.

My assumption is if i decrease/increase WCU count, i should see changes in script execution time, which is not in my case.

Dynamo DB Scenario tests:

Dynamo DB Scenario tests

Upvotes: 0

Views: 1138

Answers (2)

Deiv
Deiv

Reputation: 3097

WCU/RCU do not increase the speed of a DynamoDB SDK response time, they only set an upper limit for capacity usage.

Read and Write Capacity Units are, as the name suggests, capacity units. They indicate the upper limit of how much capacity your table can handle in terms of read/write. What this means is, in your case since you are using 809.63 WCU, if your WCU is set to above 810 then you won't get any throttled requests. However, if you lower your WCU to 800, you will start seeing your requests being throttled.

If you have consistent TPS and know how many capacity units you will be using, then set just the amount that you will require. In your case, 1k WCU seems sufficient and will not make any difference compared to 10k in terms of performance, unless you use more than 1k WCU, in which case you can provision more capacity or implement auto-scaling to handle it.

See here for more information: Documentation

Edit: As discussed in below comments, if you use more capacity than is provisioned, DynamoDB will temporarily allow a burst of capacity to support it for up to 5 minutes, which could lead to varying results in terms of throttling

Upvotes: 1

praj hegde
praj hegde

Reputation: 15

Before answering, many Thanks to Deiv & Stu for finding this evidence.
DynamoDB can consume up to 300 seconds of unused throughput in burst capacity.

The maximum item size in DynamoDB is 400KB and 1 RCU gives you a read of up to 4KB.

Lets say you want to read an item that is 400KB in size and you have 1 RCU on your table. You could retrieve that item once every 100 seconds.

Because of burst capacity there will always be a time you can read that item, because in fact you can use up to 300 RCUs in one go, not just 1.

Imagine starting the table with that 400KB item. You need to wait 100 seconds without spending any RCUs so that you've earned enough burst capacity to get the item. After 101 seconds you make the request, spend 100 RCUs and get the item. After another 5 seconds you make the request again, but get denied with a Throttling Exception.

So no, DynamoDB will not increase request latency to meet your RCU provision. It either returns your results as fast as possible, or throws an exception.

Upvotes: 1

Related Questions