Understand All DynamoDB Capacity Modes
What Is DynamoDB Read Capacity?
Read Capacity tells us how much data can be read from a DynamoDB table. Read Capacity is measured in RCUs.
What Is DynamoDB RCU?
RCU or "Read capacity unit" represents one strongly consistent read per second, or two eventually consistent reads per second, for an item up to 4 KB in size.
What Is DynamoDB Write Capacity?
DynamoDB Write Capacity tells us how much data can be written to a DynamoDB table. Write Capacity is measured in WCUs.
What Is DynamoDB WCU?
WCU or "Write Capacity Unit" represents one write per second, for an item up to 1 KB in size.
DynamoDB Provisioned Capacity
DynamoDB Provisioned Capacity is the amount of read and write operations that a DynamoDB table can support. DynamoDB uses this information to reserve sufficient system resources internally to meet your I/O requirements.
DynamoDB Reserved Capacity
Reserved Capacity is a cost-saving feature that allows you to obtain discounts on your provisioned DynamoDB tables throughput capacity in exchange for a commitment to a certain usage level with 1-year or 3-year terms and a one-time up-front payment. Costs savings can be as high as 76%, but that depends on the selected terms and whether you're going to pay partially or fully upfront.
DynamoDB Adaptive Capacity
Sometimes your read and writes operations are not evenly distributed among keys and partitions. This kind of imbalanced workload can lead to hot partitions and in consequence - throttling. Adaptive Capacity aims to solve this problem bt allowing to continue reading and writing form these partitions without rejections. Adaptive capacity is enabled automatically and instantly for partitions that receive more traffic.
DynamoDB Burst Capacity
To prevent from an excessive amount of throttling, DynamoDB provides some flexibility around consuming read and write capacity. Whenever DynamoDB clients are not fully using provisioned throughput, DynamoDB retains up to 5 minutes of unused read and write capacity. During an occasional spike of activity, these extra capacity units accumulated in that period will be consumed to satisfy the I/O requirements.
DynamoDB On-Demand Capacity
This is the truly Serverless mode of DynamoDB. In on-demand capacity mode, you're billed for the exact amount of data reads and writes. You don't need to provision any upfront number, it's pay-what-you-use model. If you have a rough number of read and write operations your app will be doing, you can use our costs calculator to get an estimate.
Frequently Asked Questions
How do you select capacity mode in DynamoDB?
It's up to you. There are two selectable capacity modes in DynamoDB: Provisioned and On-Demand. While On-demand is perfect for unpredictable workloads with sudden spikes of traffic, the provisioned mode is cheaper and better suited for workloads with predictable traffic.
What happens if the application performs more reads or writes than your provisioned capacity?
Burst capacity kicks in.
How do you scale DynamoDB?
You don't! At least in not in the classical sense. AWS DynamoDB is fully managed service. It means that AWS engineers take care of provisioning and running machines where DynamoDB runs. Your responsibility is reduced to table administration.
DynamoDB scaling applies only to some extent when you're using Provisioned capacity mode. It is possible that the provisioned amount of read/write capacity units might be insufficient sometimes, and this is the moment when you should consider updating your table with a bigger number of provisioned read and write units. If you're creating DynamoDB table using AWS Console, the autoscaling option there is enabled by default. For more information, head to official AWS guide.
What is throttling in DynamoDB?
Throttled is a synonym for rejected. There are two causes for that:
- Not enough capacity - you've exhausted write capacity of a table or in other words, you're trying to write much more data than the table was provisioned for. The solution for this is simple: provision more Write Capacity Units.
- Hot partitions - your writes are getting rejected because you're requesting data from one of the partitions much more frequently than from the rest of the table or other partition. In this case, the solution might be not that simple.
First, you'll need to identify which keys are affected and then try to distribute reads and writes as evenly as possible across your table.
You should also think about caching using DAX or in-memory store.
How long does it take to update DynamoDB table capacity?
How does DynamoDB provisioned capacity differ from on-demand capacity?
There are two fundamental differences:
- Provisioned Capacity is "provisioned". This means you as a user have to define an exact number of read and write capacity units available per table. In on-demand capacity mode, you're not provisioning or setting any number of units.
- Tables with On-demand capacity mode are billed per "Read/Write Capacity Units" (RCU/WCU) while tables with provisioned capacity are billed per "Read/Write Request Units" (RRU/WRU).
One RCU can perform one standard (up to 4 KB) read request per second. One RRU can perform one standard (up to 4 KB) read request (not per second!)
One WCU can perform one standard (up to 1 KB) write request per second. One WRU can perform one standard (up to 1 KB) write request (not per second!)
What in DynamoDB does not consume capacity units?
There are few things in DynamoDB that don't consume any capacity units, these are:
- Creating snapshot backup of the table and restoring it (billed per GB/month)
- Having Continious backups for point in time recovery enabled (billed per GB/month)
- Running DynamoDB Accelerator aka DAX (billed per Node-hour)
- Streaming changes using DynamoDB Streams (billed on stream read request units, separate from table RCU/RRU)
- Transferring the data to another region (billed per GB)
© 2020 Dynobase