Determining required read/write capacity units

When using provisioned capacity mode, we will need to determine the capacity units for our database table, based on the characteristics of the read capacity units (RCUs) and write capacity units (WCUs): 

  • A RCU is defined as one strongly consistent read or two eventually consistent reads of 4 KB in size.
  • A WCU is defined as one write request of 1 KB in size.

For example, if we know our application is sending in data at a rate of 1 MB per second in writes of exactly 1 KB in size, then we need to assign 1,024 capacity units to the application. The writes are rounded up to the 1 KB unit size, so if your 1 MB per second rate is composed of 500-byte writes, then you will consume 1 WCU for each 500-byte write. This means you will require approximately 2,000 WCUs to achieve the same 1 MBps throughput to the table. If your writes are up to 2 KB in size, then each write will consume two WCUs, meaning a 500-byte and 2 KB write will both require about 2,000 WCUs at 1 MB per second, while a 4 KB write will consume 4,000 WCUs.

Reads are also rounded up to 4 KB when they are smaller, meaning our 500-byte, 1 KB, 2 KB, and 4 KB items would each consume 1 RCU regardless of their size. Reads of more than 4 KB would of course consume two or more RCUs.

This pattern means that we need to design our item sizes correctly to make the best use of the DynamoDB tables. As mentioned before, the item sizes can be up to 400 KB in size; such an item would consume 400 WCUs when written, 100 RCUs when read with strong consistency, and 50 RCUs when read with eventual consistency, as eventually consistent reads can perform up to two 4 KB reads per RCU.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset