Bird
Raised Fist0
DynamoDBquery~20 mins

Read and write capacity units in DynamoDB - Practice Problems & Coding Challenges

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
Challenge - 5 Problems
🎖️
Capacity Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
Calculating Read Capacity Units for Strongly Consistent Reads

You have a DynamoDB table with items of size 3 KB each. You want to perform 100 strongly consistent read operations per second. How many read capacity units (RCUs) do you need to provision?

A100 RCUs
B200 RCUs
C300 RCUs
D400 RCUs
Attempts:
2 left
💡 Hint

Remember that one strongly consistent read capacity unit can read up to 4 KB per second.

query_result
intermediate
2:00remaining
Write Capacity Units for Large Items

You want to write 50 items per second to a DynamoDB table. Each item is 2 KB in size. How many write capacity units (WCUs) do you need to provision?

A150 WCUs
B50 WCUs
C100 WCUs
D200 WCUs
Attempts:
2 left
💡 Hint

One write capacity unit can write up to 1 KB per second.

📝 Syntax
advanced
2:00remaining
Identify the Error in Capacity Unit Calculation Expression

Which of the following expressions correctly calculates the number of read capacity units needed for eventually consistent reads of 150 items per second, each 5 KB in size?

ARCUs = 150 * CEIL(5 / 4) / 2
BRCUs = 150 * CEIL(5 / 4) * 2
CRCUs = 150 / 2 * CEIL(5 / 4)
DRCUs = CEIL(150 * 5 / 4) / 2
Attempts:
2 left
💡 Hint

Eventually consistent reads consume half the RCUs of strongly consistent reads.

🔧 Debug
advanced
2:00remaining
Debugging Provisioned Capacity Calculation for Mixed Reads

A developer wrote this formula to calculate total RCUs for 100 strongly consistent reads and 200 eventually consistent reads per second, each item 3 KB:

total_RCU = (100 + 200) * CEIL(3 / 4) / 2

What is the problem with this formula?

DynamoDB
total_RCU = (100 + 200) * CEIL(3 / 4) / 2
AIt should add 2 to the reads before multiplying
BIt incorrectly divides the sum of reads by 2, applying eventually consistent factor to all reads
CIt should use item size 4 KB instead of 3 KB
DIt should multiply by 2 instead of dividing by 2
Attempts:
2 left
💡 Hint

Strongly consistent reads consume full RCUs, eventually consistent reads consume half.

🧠 Conceptual
expert
3:00remaining
Optimizing Capacity Units for Variable Item Sizes

You have a DynamoDB table with items of varying sizes: 50% are 1 KB, 30% are 3 KB, and 20% are 7 KB. You expect 100 writes per second. How should you provision write capacity units (WCUs) to minimize cost while avoiding throttling?

AProvision WCUs based on median item size (3 KB) for all writes: 100 * 3 = 300 WCUs
BCalculate weighted average item size and provision WCUs accordingly: (0.5*1 + 0.3*3 + 0.2*7) * 100 = 3.2 * 100 = 320 WCUs
CProvision WCUs based on the smallest item size (1 KB) for all writes: 100 * 1 = 100 WCUs
DProvision WCUs based on the largest item size (7 KB) for all writes: 100 * 7 = 700 WCUs
Attempts:
2 left
💡 Hint

DynamoDB charges WCUs per 1 KB chunk per write. Underprovisioning causes throttling.

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