Lesson 2 of 6 Amazon DynamoDB

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.

ModeBillingBest for
On-demandPer request; scales instantly with no planningNew, unpredictable or spiky workloads
ProvisionedRead and write capacity units per hour, with auto scaling and optional reserved capacity; throttles beyond capacitySteady, predictable traffic (cheapest)

A table can switch between modes, with limits on how often.

Sort into groups

On-demand or provisioned?

Exam skills 4.3.3 · 3.3.2

Choose the DynamoDB capacity mode for each table.

Log in to try this activity Interactive activities are free with an account.

Capacity units

Provisioned capacity is measured in read and write capacity units. The following table describes what each unit covers.

UnitCovers
1 RCUOne strongly consistent read, or two eventually consistent reads, of up to 4 KB per second
1 WCUOne write of up to 1 KB per second
TransactionsTwice the units of a standard read or write

Item sizes are rounded up before calculating: a 6 KB strongly consistent read needs 2 RCUs.

Fill in the value

Capacity units

Exam skills 3.3.2 · 4.3.3

Work out DynamoDB capacity units.

Log in to try this activity Interactive activities are free with an account.

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.

Match the pairs

DynamoDB cost features

Exam skills 4.3.3 · 4.1.9

Match each requirement with the DynamoDB cost feature that meets it.

Log in to try this activity Interactive activities are free with an account.
Worked example

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.

WorkloadCapacity mode
A new application with unknown trafficOn-demand
Spiky traffic that jumps tenfold in minutesOn-demand
Steady, predictable traffic all dayProvisioned with auto scaling (cheaper per request)
Steady traffic, committed for a yearProvisioned 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.

Check yourself

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.