Bird
Raised Fist0
DynamoDBquery~10 mins

Read and write capacity units in DynamoDB - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Concept Flow - Read and write capacity units
Start: Request to DynamoDB
Check Request Type
Calculate Read
Consume Read CUs
Return Success or Throttle
End
This flow shows how DynamoDB handles read and write requests by calculating and consuming capacity units, then returning success or throttling.
Execution Sample
DynamoDB
Request: Read 3 items (6 KB each)
Request: Write 2 items (2 KB each)
Calculate Read Capacity Units
Calculate Write Capacity Units
Consume capacity units
Return response
This example calculates how many read and write capacity units are consumed by requests and shows the result.
Execution Table
StepRequest TypeItem Size (KB)Items CountCapacity Units NeededCapacity Units ConsumedResult
1Read6366Success
2Write2222Success
3Read6366Success
4Write2222Success
5Read6366Success
6Write2222Success
7Read6366Success
8Write2222Success
9Read6366Success
10Write2222Success
11Read6366Throttle
12Write2222Throttle
💡 Capacity units exceeded provisioned limits at step 11 and 12, causing throttling.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 10After Step 12
Read Capacity Units Consumed0663036
Write Capacity Units Consumed0021012
Provisioned Read Capacity Units3030303030
Provisioned Write Capacity Units2020202020
Key Moments - 2 Insights
Why does the read request for 3 items of 6 KB each consume 6 read capacity units?
Because DynamoDB calculates strongly consistent read capacity units as ceil(item size in KB / 4) per item. For a 6 KB item: ceil(6/4) = 2 RCUs per item. Therefore, 3 items × 2 RCUs = 6 RCUs.
Why does throttling happen at step 11 and 12 even though each request seems small?
Because the total consumed capacity units have reached the provisioned limits (30 read and 20 write units). After multiple requests, the sum exceeds these limits, causing throttling as shown in execution_table rows 11 and 12.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, how many read capacity units are consumed at step 5?
A3
B6
C9
D12
💡 Hint
Check the 'Capacity Units Consumed' column for step 5 in the execution_table.
At which step does throttling first occur according to the execution table?
AStep 9
BStep 10
CStep 11
DStep 12
💡 Hint
Look for the first 'Throttle' result in the 'Result' column of the execution_table.
If each write item size doubled, how would the write capacity units consumed change at step 2?
AIt would double
BIt would stay the same
CIt would halve
DIt would quadruple
💡 Hint
Capacity units scale with item size; doubling item size doubles units consumed as seen in variable_tracker.
Concept Snapshot
Read and write capacity units measure how much throughput your DynamoDB requests use.
One read capacity unit = 1 strongly consistent read of 4 KB per second.
One write capacity unit = 1 write of 1 KB per second.
Requests consuming more data use more capacity units.
Exceeding provisioned units causes throttling.
Plan capacity units based on item size and request rate.
Full Transcript
This visual execution shows how DynamoDB calculates and consumes read and write capacity units for requests. Each read or write request consumes capacity units based on item size and consistency. The execution table traces multiple requests consuming capacity units until the provisioned limits are reached, causing throttling. The variable tracker shows how consumed units accumulate over steps. Key moments clarify why capacity units are calculated as they are and why throttling happens. The quiz tests understanding of capacity unit consumption and throttling points. The snapshot summarizes the core rules for read and write capacity units in DynamoDB.

Practice

(1/5)
1. What do read and write capacity units control in a DynamoDB table?
easy
A. The number of reads and writes the table can handle per second
B. The size of the data stored in the table
C. The number of tables in the database
D. The security settings of the table

Solution

  1. Step 1: Understand capacity units meaning

    Read and write capacity units define how many read and write operations a DynamoDB table can perform each second.
  2. Step 2: Identify what capacity units control

    They control throughput, not storage size, number of tables, or security settings.
  3. Final Answer:

    The number of reads and writes the table can handle per second -> Option A
  4. Quick Check:

    Capacity units = throughput control [OK]
Hint: Capacity units = max reads/writes per second [OK]
Common Mistakes:
  • Confusing capacity units with storage size
  • Thinking capacity units control security
  • Assuming capacity units limit number of tables
2. Which of the following is the correct way to specify write capacity units when creating a DynamoDB table using AWS CLI?
easy
A. --capacity ReadUnits=5,WriteUnits=10
B. --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10
C. --throughput ReadCapacity=5 WriteCapacity=10
D. --provisioned-throughput ReadUnits=5 WriteUnits=10

Solution

  1. Step 1: Recall AWS CLI syntax for capacity units

    The correct syntax uses --provisioned-throughput with ReadCapacityUnits and WriteCapacityUnits keys.
  2. Step 2: Match options with correct syntax

    --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10 matches the exact syntax; others use incorrect keys or formats.
  3. Final Answer:

    --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10 -> Option B
  4. Quick Check:

    Correct CLI syntax = --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=10 [OK]
Hint: Look for 'ReadCapacityUnits' and 'WriteCapacityUnits' keys [OK]
Common Mistakes:
  • Using incorrect keys like ReadUnits or WriteUnits
  • Missing commas or using wrong separators
  • Confusing throughput with capacity keywords
3. A DynamoDB table has 10 write capacity units. If each write item is 2 KB, how many writes per second can the table handle without throttling?
medium
A. 5 writes per second
B. 10 writes per second
C. 20 writes per second
D. 1 write per second

Solution

  1. Step 1: Understand write capacity unit size

    One write capacity unit allows one write per second for an item up to 1 KB.
  2. Step 2: Calculate writes for 2 KB items

    Each 2 KB item requires 2 write capacity units. With 10 units, 10 / 2 = 5 writes per second.
  3. Final Answer:

    5 writes per second -> Option A
  4. Quick Check:

    Write capacity units / item size factor = writes/sec [OK]
Hint: Divide capacity units by item size in KB [OK]
Common Mistakes:
  • Assuming 1 unit = 2 KB write
  • Not dividing capacity units by item size
  • Confusing read and write capacity units
4. You set a DynamoDB table's read capacity units to 5 but your application experiences throttling at 3 reads per second. What is the most likely cause?
medium
A. The table is in the wrong AWS region
B. The table has too many write capacity units
C. Each read item is larger than 4 KB, requiring more capacity units
D. The table's storage size is too large

Solution

  1. Step 1: Recall read capacity unit size

    One read capacity unit supports one strongly consistent read per second for an item up to 4 KB.
  2. Step 2: Analyze throttling cause

    If items are larger than 4 KB, each read consumes multiple units, so 5 units may not support 3 reads per second.
  3. Final Answer:

    Each read item is larger than 4 KB, requiring more capacity units -> Option C
  4. Quick Check:

    Item size affects read capacity usage [OK]
Hint: Check item size vs 4 KB read unit size [OK]
Common Mistakes:
  • Blaming write capacity units for read throttling
  • Ignoring item size impact on capacity
  • Thinking region or storage size causes throttling
5. You want to optimize costs for a DynamoDB table with variable traffic. Which approach best uses read and write capacity units efficiently?
hard
A. Set capacity units to zero when not using the table
B. Set very high fixed capacity units to avoid throttling
C. Manually increase capacity units once a month
D. Use on-demand capacity mode to automatically adjust units based on traffic

Solution

  1. Step 1: Understand capacity modes

    DynamoDB offers on-demand mode that adjusts capacity automatically to traffic, optimizing cost and performance.
  2. Step 2: Compare options for cost efficiency

    Setting high fixed units wastes money; manual changes are slow; zero units disables table. On-demand is best for variable traffic.
  3. Final Answer:

    Use on-demand capacity mode to automatically adjust units based on traffic -> Option D
  4. Quick Check:

    On-demand mode = auto scaling capacity [OK]
Hint: Choose on-demand for variable traffic [OK]
Common Mistakes:
  • Setting fixed high capacity wastes money
  • Manually adjusting capacity is inefficient
  • Setting zero units disables table access