Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB - How to calculate the read throughput for queries

Consider the following case:

I have a table with read and write capacity both set to 100. Assume the table has 10000 entries and each entry is 0.5KB.

With this, I can read 100 records of 4KB each and write 100 records of 1KB each per second.

From the AWS docs

You can use the Query and Scan operations to retrieve multiple consecutive items from a table or an index, in a single request. With these operations, DynamoDB uses the cumulative size of the processed items to calculate provisioned throughput. For example, if a Query operation retrieves 100 items that are 1 KB each, the read capacity calculation is not (100 × 4 KB) = 100 read capacity units, as if those items had been retrieved individually using GetItem or BatchGetItem. Instead, the total would be only 25 read capacity units, as shown following:

(100 * 1024 bytes = 100 KB) / 4 KB = 25 read capacity units

I want to issue a query (using the hash key and range key unspecified) and it'll retrieve say 1000 items. So the cumulative size of the returned records is 1000 * 0.5KB = 500KB.

Question:

Should the read throughput be 500/4 = 125? or 100(or anything around 80) is sufficient because the Query is not going to complete in one second

How can I determine the throughput for this(Query) case?

Thanks..

like image 274
user7 Avatar asked Nov 09 '22 18:11

user7


1 Answers

When you run a query or a scan, you consume reads based on the size of the data scanned or queried, not the number of records. If you query 500KB using the strongly consistent reads it will consume 125 read capacity units.

There is an option ReturnConsumedCapacity that will return the consumed read capacity along with your data.

like image 114
cementblocks Avatar answered Nov 14 '22 21:11

cementblocks