suman j
suman j

Reputation: 6980

aws dynamodb read capacity query

As per DynamoDB ReadWriteCapacity

Units of Capacity required for writes = Number of item writes per second x item size in 1KB blocks

Units of Capacity required for reads* = Number of item reads per second x item size in 4KB blocks

  • If you use eventually consistent reads you’ll get twice the throughput in terms of reads per second.

If your items are less than 1KB in size, then each unit of Read Capacity will give you 1 strongly consistent read/second and each unit of Write Capacity will give you 1 write/second of capacity. For example, if your items are 512 bytes and you need to read 100 items per second from your table, then you need to provision 100 units of Read Capacity.

I am confused with 4kb blocks and 1kb example mentioned above. If an item is 512 bytes, will it be rounded to 4kb and hence 1 read unit allows 1 item read/second? I assumed Item will be rounded to 1kb and hence 1 read capacity results in reading 4 items/seconds (and 8 items/second with eventual consistent). Is this assumption correct?

Upvotes: 1

Views: 679

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179404

Let ceil() be a function that rounds non-integer values up to the next highest integer.

  • 1 write unit allows you to write 1 / ceil(item_size / 1kB) items per second.

  • 1 read unit allows you to read 1 / ceil(item_size / 4kB) items per second.

So, for example:

48 write capacity units allows 48 writes of items up to 1 kB, or 24 writes of items over 1kB up to 2kB, or 16 writes of items over 2kB up to 3kB, etc.

48 read capacity units allows you to read 48 items up to 4kB, or 24 items over 4kB up to 8kB.

You can't do more than your subscribed rate, and you may only be able to do less, if the items exceed the block size for the operation in question.

If your items are less than 1KB in size, then each unit of Read Capacity will give you 1 strongly consistent read/second and each unit of Write Capacity will give you 1 write/second of capacity.

This is accurate because items that are <= 1kB (the write block size) are also =< 4kB (the read block size) by definition.

Upvotes: 4

Related Questions