Choosing a DynamoDB Capacity Mode
This lesson explains how DynamoDB capacity is bought per request or as provisioned throughput, and how choosing the mode is mostly a question of how predictable the traffic is.
Learning outcomes
After completing this lesson, you will be able to:
- Choose between on-demand and provisioned capacity.
- Calculate read and write capacity units.
- Describe cost features such as the Standard-Infrequent Access table class, TTL and reserved capacity.
The two modes
DynamoDB offers two capacity modes, which differ in how throughput is paid for. In on-demand mode, each request is charged, and the table accommodates traffic automatically, including sudden spikes, with no capacity planning. It suits new tables whose traffic is unknown, spiky or unpredictable workloads, and tables that are idle much of the time.
In provisioned mode, you set read and write capacity units, paid for each hour whether used or not, and auto scaling adjusts them as traffic changes. Requests beyond the provisioned capacity are throttled until it rises, but for steady, predictable traffic this mode is the cheapest, especially with reserved capacity. The following table summarises the modes.
| Mode | Billing | Best for |
|---|---|---|
| On-demand | Per request; scales instantly with no planning | New, unpredictable or spiky workloads |
| Provisioned | Read and write capacity units per hour, with auto scaling and optional reserved capacity; throttles beyond capacity | Steady, predictable traffic (cheapest) |
A table can switch between modes, with limits on how often.
On-demand or provisioned?
Capacity units
Provisioned capacity is measured in read and write capacity units. The following table describes what each unit covers.
| Unit | Covers |
|---|---|
| 1 RCU | One strongly consistent read, or two eventually consistent reads, of up to 4 KB per second |
| 1 WCU | One write of up to 1 KB per second |
| Transactions | Twice the units of a standard read or write |
Item sizes are rounded up before calculating: a 6 KB strongly consistent read needs 2 RCUs.
Capacity units
Cost features
DynamoDB offers several features that reduce cost. The Standard-Infrequent Access table class offers cheaper storage for tables whose data is rarely read, at a higher price per request, which suits data such as old orders kept for reference.
Time to live (TTL) deletes expired items automatically, at no cost and without consuming write capacity, which suits sessions and temporary data. For steady workloads in provisioned mode, reserved capacity discounts throughput in return for a one-year or three-year commitment.
DynamoDB cost features
On-demand or provisioned?
The appropriate DynamoDB capacity mode depends on the traffic pattern of the workload. The following table identifies the mode suited to several workloads.
| Workload | Capacity mode |
|---|---|
| A new application with unknown traffic | On-demand |
| Spiky traffic that jumps tenfold in minutes | On-demand |
| Steady, predictable traffic all day | Provisioned with auto scaling (cheaper per request) |
| Steady traffic, committed for a year | Provisioned with reserved capacity |
A team can start on-demand, observe the real traffic pattern, and move to provisioned capacity once it is predictable. If a table throttles even though total capacity is ample, the cause is usually a hot partition key, which no capacity mode fixes; the key design must change.
What does one write capacity unit provide?
Show answer
One write per second of an item up to 1 KB. Larger items use more units, and transactional writes cost twice as much.
Exam Tips
Remember for the exam
- For unpredictable traffic or new applications use on-demand; for steady, predictable traffic use provisioned capacity with auto scaling.
- To expire session data automatically at no cost, use TTL.
- For tables whose data is rarely read, use the Standard-IA table class.
- Round item sizes up when calculating capacity units.