⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials ⚖️ Editorial Policy Standards & Trust 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 68 of 69 in Databases & Storage
Senior DevOps / SRE Database AWS Aurora & DynamoDB Production Runbook
🎯 Target Role / Context: Senior DevOps / SRE DynamoDB Capacity & Key Design Interview Scenario

Q: How do you remediate ProvisionedThroughputExceededException caused by hot partitions in DynamoDB?

DynamoDB interview questions on hot partitions: find hot keys with Contributor Insights, shard writes with suffixes, scatter-gather reads, on-demand tradeoffs.

#DynamoDB #Hot Partition #Write Sharding #Contributor Insights #AWS #SRE
🎙️ Candidate Opening & Architectural Context
"Throttling with spare table capacity is a classic in dynamodb interview questions. Each partition can serve up to 3,000 read capacity units and 1,000 write capacity units per second. Adaptive capacity can shift throughput toward busy partitions, but it cannot push a single partition key past those per-partition limits. When one key takes most of the traffic, such as a global counter or a popular tenant id, you get ProvisionedThroughputExceededException even though CloudWatch shows the table well under its provisioned total. The fix is to find the hot key and spread it across several keys. This is the runbook I follow."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: Throttling with spare table capacity is a classic in dynamodb interview questions. Each partition can serve up to 3,000 read capacity units and 1,000 write capacity units per second. Adaptive capacity can shift throughput toward busy partitions, but it cannot push a single partition key past those per-partition limits. When one key takes most of the traffic, such as a global counter or a popular tenant id, you get ProvisionedThroughputExceededException even though CloudWatch shows the table well under its provisioned total. The fix is to find the hot key and spread it across several keys. This is the runbook I follow.

1

Confirm Throttling and Compare It with Provisioned Capacity

First check that throttling is real and that the table total is not the limit. WriteThrottleEvents above zero while ConsumedWriteCapacityUnits sits below ProvisionedWriteCapacityUnits is the signature of a hot partition. I also describe the table to confirm billing mode and provisioned numbers.

aws dynamodb describe-table --table-name Orders \
  --query 'Table.{Mode:BillingModeSummary.BillingMode,Prov:ProvisionedThroughput}'

aws cloudwatch get-metric-statistics --namespace AWS/DynamoDB \
  --metric-name WriteThrottleEvents --dimensions Name=TableName,Value=Orders \
  --start-time 2026-11-29T09:00:00Z --end-time 2026-11-29T10:00:00Z \
  --period 300 --statistics Sum
# Datapoints: [{"Sum": 1840.0, ...}]
2

Find the Hot Keys with CloudWatch Contributor Insights

Contributor Insights for DynamoDB reports the most accessed and most throttled partition keys, which is what you need to name the culprit. Enable it on the table, let it collect during the incident window, then read the rules in CloudWatch. It adds its own cost, so I enable it for diagnosis and decide afterward whether to keep it on.

aws dynamodb update-contributor-insights \
  --table-name Orders --contributor-insights-action ENABLE

aws dynamodb describe-contributor-insights --table-name Orders
# "ContributorInsightsStatus": "ENABLED"

# Find the generated rule names, then open the report in the CloudWatch console
aws cloudwatch describe-insight-rules \
  --query 'InsightRules[?contains(Name, `Orders`)].Name'
Advertisement
3

Shard the Partition Key with a Write Suffix

Once you know the hot key, append a bounded suffix so writes land on several partition key values: customer-42#0 up to customer-42#N-1. I choose N from peak writes per second divided by a safe per-key rate, with headroom, and I treat it as a tuning value. A random suffix spreads load evenly. A calculated suffix, such as a hash of an order id, keeps a given item always on the same shard, which makes point reads possible without scanning every shard.

import random, boto3
table = boto3.resource("dynamodb").Table("Orders")
SHARDS = 10

def put_order(customer_id, order_id, payload):
    shard = random.randint(0, SHARDS - 1)
    table.put_item(Item={
        "pk": f"{customer_id}#{shard}",
        "sk": f"ORDER#{order_id}",
        **payload,
    })
4

Read with Scatter-Gather Across the Shards

Sharding moves the cost to reads. To list everything for one logical key, query each suffix and merge the results in the application. I run the shard queries in parallel and sort the merged list client-side if the order matters. For counters, I store partial counts per shard and sum them on read.

for i in $(seq 0 9); do
  aws dynamodb query --table-name Orders \
    --key-condition-expression "pk = :p" \
    --expression-attribute-values "{\":p\":{\"S\":\"customer-42#$i\"}}" \
    --select COUNT --query 'Count' --output text
done
# 118
# 131
# ... one count per shard, summed by the caller
5

Decide on On-Demand Mode and Know Its Limits

On-demand billing removes capacity planning and absorbs spiky traffic, and it is a reasonable short-term mitigation. It does not remove the per-partition ceiling, so a single key that exceeds it will still throttle. It also costs more per request than well-tuned provisioned capacity at steady load. I switch to on-demand to stop the incident, shard the hot key, then review whether provisioned with auto scaling is cheaper for the steady state. Switching billing modes has a limit on how often you can change it, so check the current documentation before planning repeated flips.

aws dynamodb update-table --table-name Orders --billing-mode PAY_PER_REQUEST

aws dynamodb describe-table --table-name Orders \
  --query 'Table.BillingModeSummary.BillingMode'
# "PAY_PER_REQUEST"
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"For dynamodb interview questions on throttling, explain that per-partition limits (3,000 RCU and 1,000 WCU) apply even when table capacity is spare, use Contributor Insights to find the hot key, shard it with a bounded suffix and read with scatter-gather, and treat on-demand mode as a mitigation that does not lift the per-partition ceiling."
⚡ 60-Second Elevator Pitch Talking Points
  • I compare WriteThrottleEvents with consumed versus provisioned capacity to confirm a hot partition rather than an undersized table.
  • I enable Contributor Insights to identify the most accessed and throttled keys.
  • I add a bounded suffix such as partition_key#N to spread writes, and query every suffix to read them back.
  • I use on-demand mode to stop the incident, then reassess cost once the key design is fixed.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Raising provisioned WCU to fix a single hot key Per-partition limits still apply, so the extra capacity goes unused on the other partitions.
  2. Using an unbounded or timestamp-based suffix Readers cannot know which keys to query, and the load may stay concentrated on the latest value.
  3. Assuming on-demand removes throttling A key that exceeds per-partition throughput still throttles in on-demand mode.
  4. Leaving Contributor Insights enabled indefinitely without review It has its own charges, so decide deliberately whether the ongoing visibility is worth it.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →