Provisioned Throughput in Amazon DynamoDB
When you create or update a table, you specify how much provisioned throughput capacity you want to reserve for reads and writes. DynamoDB will reserve the necessary machine resources to meet your throughput needs while ensuring consistent, low-latency performance.
A unit of read capacity represents one strongly consistent read per second (or two eventually consistent reads per second) for items as large as 4 KB. A unit of write capacity represents one write per second for items as large as 1 KB.
Items larger than 4 KB will require more than one read operation. The total number of read operations necessary is the item size, rounded up to the next multiple of 4 KB, divided by 4 KB. For example, to calculate the number of read operations for an item of 10 KB, you would round up to the next multiple of 4 KB (12 KB) and then divide by 4 KB, for 3 read operations.
The following table explains how to calculate the provisioned throughput capacity that you need.
|Capacity Units Required For||How to Calculate|
Number of item reads per second × 4 KB item size
(If you use eventually consistent reads, you'll get twice as many reads per second.)
|Writes||Number of item writes per second × 1 KB item size|
If your application's read or write requests exceed the provisioned throughput for a table, then those requests might be throttled. You can use the AWS Management Console to monitor your provisioned and actual throughput and to change your provisioned capacity in anticipation of traffic changes.
For more information about specifying the provisioned throughput requirements for a table, see Specifying Read and Write Requirements for Tables.
For tables with secondary indexes, DynamoDB consumes additional capacity units. For example, if you wanted to add a single 1 KB item to a table, and that item contained an indexed attribute, then you would need two write capacity units—one for writing to the table, and another for writing to the index. For more information, see:
Read Capacity Units
If your items are smaller than 4 KB in size, each read capacity unit will give you one strongly consistent read per second, or two eventually consistent reads per second. You cannot group multiple items in a single read operation, even if the items together are 4 KB or smaller. For example, if your items are 3 KB and you want to read 80 items per second from your table, then you need to provision 80 (reads per second) × 1 (3 KB / 4 KB = 0.75, rounded up to the next whole number) = 80 read capacity units for strong consistency. For eventual consistency, you need to provision only 40 read capacity units.
If your items are larger than 4 KB, you will need to round up the item size to the next 4 KB boundary. For example, if your items are 6 KB and you want to do 100 strongly consistent reads per second, you need to provision 100 (reads per second) × 2 (6 KB / 4 KB = 1.5, rounded up to the next whole number) = 200 read capacity units.
You can use the
Scan operations in
DynamoDB 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 were retrieved
Instead, the total would be only 25 read capacity units ((100 * 1024 bytes) = 100 KB,
which is then divided by 4 KB). For more information see Item Size Calculations.
Write Capacity Units
If your items are smaller than 1 KB in size, then each write capacity unit will give you 1 write per second. You cannot group multiple items in a single write operation, even if the items together are 1 KB or smaller. For example, if your items are 512 bytes and you want to write 100 items per second to your table, then you would need to provision 100 write capacity units.
If your items are larger than 1 KB in size, you will need to round the item size up to the next 1 KB boundary. For example, if your items are 1.5 KB and you want to do 10 writes per second, then you would need to provision 10 (writes per second) × 2 (1.5 KB rounded up to the next whole number) = 20 write capacity units.