DynamoDB Throttling Optimizer
What this skill does
Translates a DynamoDB table's throttling posture into a concrete
prevention recommendation with a throughput-denominated estimated impact.
The verdict is the highest-leverage action across eight dimensions --
partition key design, burst capacity, adaptive capacity, GSI distribution,
write capacity mode, batch write API, exponential backoff, and write
sharding -- applied in priority order. Always pairs the recommendation
with exact CLI commands.
Quick navigation
| Section |
What it covers |
When to jump here |
| Quick start |
Four headline rules and the throttling formula |
First read |
| Mindset |
Why partition key design is the #1 lever |
Understanding the approach |
| Quick reference -- verdict thresholds |
Decision matrix at a glance |
Classifying a table |
| Pre-flight data gate |
CloudWatch metrics, CloudTrail |
Before any recommendation |
| Step 0 non-obvious behaviours |
Burst capacity, adaptive capacity, GSI backpressure |
Edge cases |
| Step 1 Partition key design |
Hot partition detection, write sharding |
The headline dimension |
| Step 2 Burst capacity |
300-second burst bucket utilization |
Intermittent spikes |
| Step 3 Adaptive capacity |
Automatic redistribution limits |
Hot partition mitigation |
| Step 4 GSI distribution |
Hot GSI partition key backpressure |
GSI throttling |
| Step 5 Write capacity mode |
Provisioned vs on-demand for bursty writes |
Capacity mode decision |
| Step 6 Batch write API |
BatchWriteItem for 16x throughput |
High-volume writes |
| Step 7 Exponential backoff |
ProvisionedThroughputExceededException handling |
Client-side retry |
| Step 8 Impact estimation |
Throughput math and worked examples |
Every recommendation |
| Output format |
VERDICT block + worked examples |
Emitting the result |
| Anti-Patterns -- NEVER |
Common misclassifications |
Self-check before emit |
| Pre-flight safety checks |
CONFIRM gate, GSI backfill |
Before any apply CLI |
Quick start
- Partition key design is the #1 lever. DynamoDB distributes data
across partitions by partition key. A hot partition key (few distinct
values, uneven write distribution) causes throttling even when total
consumed capacity is below provisioned. Write sharding (random suffix)
spreads writes across partitions.
- Burst capacity gives a 5-minute window. DynamoDB accumulates
unused capacity (up to 300 seconds of provisioned throughput) and
releases it as burst capacity. Intermittent spikes that fit within
the burst window do NOT throttle. Sustained spikes beyond burst DO
throttle.
- Adaptive capacity is a safety net, not a design substitute. When
a hot partition exceeds its share of throughput, DynamoDB temporarily
redirects unused capacity from cold partitions. This prevents
immediate throttling but does not fix the underlying distribution
problem. Rely on write sharding, not adaptive capacity.
- BatchWriteItem is 16x more efficient than PutItem. A single
BatchWriteItem request writes up to 16 items (up to 16 MB) in one
round trip. This reduces request count, network overhead, and
consumed capacity per item. For high-volume writes, always use batch.
Mindset
Moved verbatim to references/advanced-patterns.md - load on demand (see References below).
Quick reference -- verdict thresholds
| Observation (14-30 day window) |
Verdict |
Recommendation |
| ThrottledRequests > 0 AND partition key cardinality is low (hot partition) |
FURTHER_OPTIMIZATION_AVAILABLE (write sharding) |
Step 1 -- add random suffix to partition key |
| ThrottledRequests > 0 AND burst capacity exhausted (sustained spikes > 5 min) |
FURTHER_OPTIMIZATION_AVAILABLE (capacity mode) |
Step 5 -- switch to on-demand OR increase WCU |
| ThrottledRequests > 0 AND GSI partition key is hot (GSI backpressure) |
FURTHER_OPTIMIZATION_AVAILABLE (GSI design) |
Step 4 -- redesign GSI partition key or use sparse index |
| Sustained writes > 1000 items/s AND using PutItem (not BatchWriteItem) |
FURTHER_OPTIMIZATION_AVAILABLE (batch) |
Step 6 -- migrate to BatchWriteItem |
| ThrottledRequests > 0 AND no exponential backoff on client |
FURTHER_OPTIMIZATION_AVAILABLE (retry) |
Step 7 -- implement backoff with jitter |
| BillingMode = PROVISIONED AND throttling on bursty, unpredictable writes |
FURTHER_OPTIMIZATION_AVAILABLE (capacity mode) |
Step 5 -- switch to on-demand |
| ThrottledRequests = 0 AND partition key well-distributed AND batch writes used |
OPTIMIZED |
Emit post-state verification |
| CloudWatch metrics absent or window < 14 days |
NEED_MORE_INFO |
Pull 14-30 day CloudWatch data, re-evaluate |
Pre-flight: data gate (run before any optimization decision)
Throttling diagnosis requires CloudWatch metrics and table configuration.
Pull these before any recommendation. Full CLI sequences are in
references/throttling-metrics-and-write-sharding.md.
Moved verbatim to references/diagnostic-commands.md - load on demand (see References below).
Data-quality short-circuits
| Condition |
Effect on optimization |
ThrottledRequests Sum = 0 over 14 days |
Emit OPTIMIZED with note "no throttling observed." |
ConsumedWriteCapacityUnits absent |
NEED_MORE_INFO. Cannot assess write pressure. |
| Observation window < 14 days |
NEED_MORE_INFO. Minimum 14 days; 30 days preferred. |
Table TableStatus != ACTIVE |
Skip optimization; surface as BLOCKED. |
GSI IndexStatus != ACTIVE (backfilling) |
GSI throttling expected during backfill; defer analysis. |
Process -- Optimization logic (apply in order)
Step 0: Non-obvious behaviours that change the recommendation
Moved verbatim to references/advanced-patterns.md - load on demand (see References below).
Step 1: Partition key design (hot partition detection, write sharding)
Partition key design is the #1 lever because DynamoDB distributes data
and throughput across partitions by partition key value. A hot partition
key (few distinct values, uneven write distribution) causes throttling
even when table-level consumed capacity is below provisioned.
Moved verbatim to references/diagnostic-commands.md - load on demand (see References below).
Hot partition diagnosis decision tree:
Is ThrottledRequests > 0?
├── NO → No partition-level throttling. Check other dimensions.
└── YES → Is partition key cardinality high (>10,000 distinct values)?
├── NO → HOT PARTITION. Apply write sharding (Step 1).
└── YES → Is write distribution even across keys?
├── NO → HOT PARTITION (skewed writes). Apply write sharding.
└── YES → Check burst capacity exhaustion (Step 2) or GSI (Step 4).
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Use write sharding ONLY for genuinely hot keys. Over-sharding low-volume
keys adds read complexity without benefit.
Step 2: Burst capacity utilization
DynamoDB accumulates unused provisioned throughput (up to 300 seconds)
as burst capacity. Understanding burst utilization is key to diagnosing
intermittent throttling.
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Diagnosis:
| Pattern |
Root cause |
Fix |
| Throttling only during brief spikes (<5 min) |
Burst capacity exhausted |
Increase WCU or switch to on-demand |
| Throttling during sustained writes (>5 min) |
Provisioned too low |
Increase WCU or on-demand |
| No throttling, burst heavily used |
Near limit |
Monitor closely, pre-provision |
Step 3: Adaptive capacity understanding
Adaptive capacity automatically redistributes unused throughput from
cold partitions to hot partitions. It is a safety net, not a design fix.
Key facts:
- Activates within seconds of a hot partition exceeding its share.
- Redirection is temporary (minutes), not permanent.
- Does NOT prevent throttling for sustained hot partitions.
- No configuration needed -- always on for provisioned tables.
Anti-pattern: Designing a table with a known hot partition key and
relying on adaptive capacity to prevent throttling. Adaptive capacity
delays throttling; write sharding (Step 1) fixes it permanently.
Step 4: GSI partition key distribution
GSI partition key design is as critical as base table partition key
design. A hot GSI partition key causes GSI throttling, which
back-pressures and throttles the base table.
Moved verbatim to references/diagnostic-commands.md - load on demand (see References below).
GSI optimization strategies:
| Problem |
Fix |
GSI partition key has low cardinality (e.g., status with 3 values) |
Use composite key: status#date or write sharding |
| GSI is a "full table scan" pattern (all items under one key) |
Redesign GSI partition key for distribution |
| GSI backfilling causes throttling |
Reduce backfill rate or use on-demand temporarily |
| GSI is sparse but back-pressures base table |
Ensure GSI partition key distributes writes evenly |
Step 5: Write capacity mode (provisioned vs on-demand)
Capacity mode decision matrix:
| Pattern |
Recommended mode |
Rationale |
| Steady, predictable traffic |
Provisioned + auto-scaling |
Lower cost; predictable capacity |
| Bursty, unpredictable traffic |
On-demand |
No throttling from capacity limits |
| Spikes >2x previous peak |
Provisioned with headroom |
On-demand 2x spike limit may throttle |
| Low traffic (<1000 WCU sustained) |
On-demand |
Simpler; no auto-scaling config needed |
| High traffic (>50,000 WCU sustained) |
Provisioned |
On-demand cost premium too high |
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Step 6: Batch write API (BatchWriteItem for 16x throughput)
BatchWriteItem writes up to 16 items (up to 16 MB total) in a single
request. This reduces request count, network overhead, and client-side
latency.
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Moved verbatim to references/error-handling.md - load on demand (see References below).
Step 7: Exponential backoff with jitter
When ProvisionedThroughputExceededException occurs, the client must
retry with exponential backoff and jitter. The AWS SDK retries
automatically by default, but custom retry logic with jitter is more
effective for sustained throttling.
Moved verbatim to references/error-handling.md - load on demand (see References below).
Retry best practices:
| Strategy |
When to use |
| SDK default retry (3 attempts) |
Low-volume, occasional throttling |
| Custom backoff with jitter (10 attempts) |
Sustained throttling, batch workloads |
| Adaptive retry (circuit breaker) |
High-volume, latency-sensitive APIs |
Step 8: Conditional writes and TTL
Moved verbatim to references/worked-examples.md - load on demand (see References below).
Moved verbatim to references/worked-examples.md - load on demand (see References below).
TTL reduces table size over time, which reduces storage cost and scan
time. TTL deletions consume background WCU -- stagger TTL values to
avoid batch-expiry throttling on provisioned tables.
Configuration dependency graph
┌──────────────────────────┐
│ ThrottledRequests > 0? │
└────────────┬─────────────┘
│
┌──────────────┴──────────────┐
YES NO
│ │
┌──────▼──────┐ ┌───────▼───────┐
│ Partition │ │ Batch write │
│ key hot? │ │ used? │
└──────┬──────┘ └───────┬───────┘
│ │
┌──────┴──────┐ ┌───────┴───────┐
YES NO YES NO
│ │ │ │
┌─────▼─────┐ ┌────▼────┐ ┌───────▼───┐ ┌───────▼───────┐
│ Write │ │ GSI │ │ OPTIMIZED │ │ Check │
│ sharding │ │ hot? │ │ │ │ capacity │
│ (Step 1) │ └────┬────┘ └───────────┘ │ mode (Step 5)│
└───────────┘ │ └──────────────┘
YES │ NO
│ └──→ Burst capacity (Step 2)
┌─────▼─────┐
│ GSI │
│ redesign │
│ (Step 4) │
└───────────┘
Decision order: partition key (write sharding) -> GSI distribution ->
burst/capacity mode -> batch write -> exponential backoff.
Output format
TARGET: <table-name>
VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE
REASON: <1-2 sentences naming the recommendation and the supporting data>
RECOMMENDATION:
Current: <billing-mode>, <WCU>, <partition key>, <GSI status>, <batch write status>
Proposed: <billing-mode>, <WCU>, <partition key>, <GSI status>, <batch write status>
Dimensions changed: <partition_key | burst | adaptive | gsi | capacity_mode | batch_write | backoff>
Dimensions checked: <list ALL eight, each ✓ (no finding) or → (finding)>
Confidence: <HIGH/MEDIUM/LOW> -- <one-line rationale>
ESTIMATED_THROUGHPUT_IMPACT:
Current throttled requests/day: <count>
Projected throttled requests/day: <count>
Throughput improvement: <description>
Root cause: <hot partition | burst exhaustion | GSI backpressure | insufficient capacity>
MIGRATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: Before executing any state-changing CLI, emit and await operator
approval: "CONFIRM: About to <action> on <table-name> in <region>.
Proceed? (yes/no)"
Full worked examples are in references/worked-examples.md.
STRICT output contract
The rules below are hard constraints. Self-check EVERY emitted block
against these rules before returning. Do NOT substitute markdown headings
or camelCase for the literal labels.
FORBIDDEN output patterns
NEVER emit VERDICT: FURTHER_OPTIMIZATION_AVAILABLE with
Projected throttled requests/day equal to current. If every
dimension nets zero improvement, verdict MUST be OPTIMIZED.
NEVER recommend write sharding without warning about read
complexity. Write sharding adds parallel read overhead. The
MIGRATION_STEPS MUST note the read pattern change.
NEVER recommend on-demand mode without citing the cost premium.
On-demand is significantly more expensive than provisioned for
steady workloads. Always pair with a cost-justification note.
NEVER recommend BatchWriteItem as a throttling fix without noting
that consumed WCU is unchanged. BatchWriteItem reduces request
count, not consumed capacity. It helps with client-side latency and
connection pool pressure, not partition-level throttling.
NEVER attribute throttling to insufficient capacity without checking
partition key distribution. Throttling is per-partition. A hot
partition throttles even when table-level consumed < provisioned.
Always check partition key cardinality and write distribution first.
NEVER omit a dimension from the RECOMMENDATION block. The
Dimensions checked line MUST list all eight dimensions.
NEVER emit scratch lines ("WAIT -- recompute", "Hmm, let me redo")
in the output.
Perfect example output -- FURTHER_OPTIMIZATION_AVAILABLE
TARGET: user-events-prod
VERDICT: FURTHER_OPTIMIZATION_AVAILABLE
REASON: PROVISIONED table with 45,000 ThrottledRequests on Write over 30
days. Partition key (user_id) has high write skew -- top 1% of user_ids
generate 80% of writes (detected via CloudTrail). Write sharding with
random suffix (10 shards) will spread writes across 10 partitions,
eliminating hot-partition throttling.
RECOMMENDATION:
Current: PROVISIONED, 3000 WCU, pk=user_id (skewed), 1 GSI, PutItem
Proposed: PROVISIONED, 3000 WCU, pk=user_id#NN (10 shards), 1 GSI, BatchWriteItem
Dimensions changed: partition_key (Step 1) + batch_write (Step 6)
Dimensions checked: partition_key → (shard) burst ✓ adaptive ✓
gsi ✓ (well-distributed) capacity_mode ✓ batch_write → (migrate)
backoff ✓ (SDK default active)
Confidence: HIGH -- CloudTrail confirms 80/20 write skew on user_id.
ESTIMATED_THROUGHPUT_IMPACT:
Current throttled requests/day: 1,500
Projected throttled requests/day: 0
Throughput improvement: 10x write capacity on hot keys (1 partition → 10)
Root cause: hot partition (write skew on user_id)
MIGRATION_STEPS:
1. Add sharding suffix to partition key on write:
pk = f"{user_id}#{random.randint(1,10).zfill(2)}"
2. Update reads to fan out across 10 shards in parallel:
Query all 10 suffixes, merge results.
3. Migrate high-volume PutItem calls to BatchWriteItem (16 items/batch):
with table.batch_writer() as batch: ...
4. Backfill existing items with sharded keys (one-time migration).
5. Monitor ThrottledRequests for 7 days post-migration.
CONFIRM: About to apply write sharding (10 suffixes) to user-events-prod
partition key. Read queries will need parallel fan-out. Proceed? (yes/no)
Self-check before emit:
Verdict semantics
| Verdict |
When to emit |
FURTHER_OPTIMIZATION_AVAILABLE |
At least one dimension has a concrete throttling-prevention recommendation. |
OPTIMIZED |
All dimensions pass (no throttling, partition keys well-distributed, batch writes used, backoff configured). |
NEED_MORE_INFO |
Data gate failed: ThrottledRequests metrics absent, window < 14 days, or CloudTrail unavailable. |
BLOCKED |
Hard precondition prevents evaluation: TableStatus != ACTIVE, GSI backfilling. |
Anti-Patterns -- NEVER (top 5)
NEVER recommend increasing WCU as the first fix for throttling.
Throttling is per-partition. A hot partition throttles regardless of
table-level WCU. Always check partition key distribution first.
NEVER rely on adaptive capacity as a design strategy. Adaptive
capacity is a temporary safety net. It delays throttling for minutes;
it does not fix sustained hot partitions. Write sharding is the
durable fix.
NEVER recommend on-demand mode without citing the cost premium.
On-demand can be 3-5x more expensive than provisioned for steady
workloads. Always pair with a cost-justification check.
NEVER recommend BatchWriteItem as a partition-level throttling fix.
BatchWriteItem reduces request count, not consumed capacity per item.
It helps with client-side patterns, not partition-level hot-spot
throttling.
NEVER add a GSI without checking its partition key distribution.
A hot GSI partition key causes GSI throttling, which back-pressures
the base table. GSI partition key design is as important as base
table partition key design.
Extended anti-patterns in references/error-handling-and-edge-cases.md.
Expert heuristic
Moved verbatim to references/advanced-patterns.md - load on demand (see References below).
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation,
emit and await operator approval.
- Write sharding changes the partition key. All reads must be
updated to fan out across suffixes. Test read paths before deploying.
- GSI changes require backfill time. Creating or modifying a GSI
takes minutes to hours depending on table size. Plan for backfill.
- Capacity mode switch is instant but has implications. Provisioned
to on-demand is instant; on-demand to provisioned requires setting
WCU/RCU. Test auto-scaling after switching to provisioned.
- BatchWriteItem migration requires code changes. Ensure the client
handles
UnprocessedItems correctly.
- TTL activation has a delay. TTL deletions begin within 48 hours
of enabling. Stagger TTL values to avoid batch-expiry throttling.
- Bulk-operation limit: 5 tables per batch. Sort by ThrottledRequests
count.
Recent AWS features (2024-2026)
Moved verbatim to references/advanced-patterns.md - load on demand (see References below).
References
references/throttling-metrics-and-write-sharding.md -- CloudWatch
metrics reference, write sharding patterns, BatchWriteItem examples,
exponential backoff code, capacity mode decision matrix, GSI
distribution analysis, partition splitting strategies.
references/worked-examples.md -- write sharding migration, GSI
redesign, capacity mode switch, batch write migration, already-
optimized, NEED_MORE_INFO, end-to-end walkthrough.
references/error-handling-and-edge-cases.md -- CLI/data-source
failure handling, GSI backfill edge cases, TTL batch-expiry
throttling, extended NEVER list, partition splitting guidance.
References (load on demand)
- references/advanced-patterns.md — Mindset five principles, Step 0 non-obvious behaviours, expert heuristic, and 2024-2026 feature changes moved from SKILL.md
- references/diagnostic-commands.md — Pre-flight data-gate sources plus hot-partition and per-GSI ThrottledRequests metric commands moved from SKILL.md
- references/error-handling.md — ProvisionedThroughputExceededException backoff-with-jitter code and BatchWriteItem UnprocessedItems retry handling moved from SKILL.md
- references/worked-examples.md — write-sharding, burst-math, capacity-mode-switch, batch-write, conditional-write and TTL code patterns moved from SKILL.md (extends the existing worked examples)
Domain
AWS CloudOps / DynamoDB Throttling Prevention & Partition Key Optimization.
AWS documentation
1---2name: dynamodb-throttling-optimizer3description: 'Optimises DynamoDB throttling prevention across eight dimensions: partition key design (hot partition detection via CloudWatch ThrottledRequests), burst capacity utilization (300-second burst bucket understanding), adaptive capacity (automatic redistribution, not a design substitute), GSI partition key distribution (hot GSI backpressure), write capacity mode (provisioned vs on-demand for bursty writes), batch write API (BatchWriteItem for 16x throughput), exponential backoff with jitter (ProvisionedThroughputExceededException handling), and write sharding (random suffix for high-cardinality hot keys). Covers conditional writes for idempotency, TTL for data lifecycle, partition splitting, and throttling root cause analysis via CloudTrail.'4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted CloudWatch metrics and table configuration. Live-account optimization uses aws dynamodb describe-table, aws dynamodb describe-limits, aws cloudwatch get-metric-statistics (ThrottledRequests, ConsumedReadCapacityUnits, ConsumedWriteCapacityUnits, ReturnedItemCount), aws cloudtrail lookup-events, and aws application-autoscaling describe-scaling-policies (AWS...6metadata:7 source: https://skillmd.com/skills/jhkchan/dynamodb-throttling-optimizer8 domain: aws-cloudops9 complexity: medium10 requires_llm: 'true'11 phase: '3'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Databases15 task_type: optimize16 skill_class: capability17 lifecycle_status: active18 verdict_shape: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE19 when_to_use: Preventing DynamoDB throttling, diagnosing hot partitions via CloudWatch ThrottledRequests, designing write-sharding strategies for high-cardinality keys, evaluating burst capacity utilization, understanding adaptive capacity limits, distributing GSI partition keys, choosing provisioned vs on-demand for bursty writes, implementing BatchWriteItem for throughput, configuring exponential backoff with jitter, or running throttling root cause analysis via CloudTrail.20 when_not_to_use: DynamoDB cost optimization without a throttling focus (use dynamodb-capacity-optimizer), DynamoDB table security or IAM auditing (use dynamodb-table-auditor), or DynamoDB schema design from scratch (use a data modeling specialist). This skill targets throttling prevention and partition-key distribution, not dollar cost or greenfield schema design.21 activation_triggers: prevent DynamoDB throttling, DynamoDB hot partition, DynamoDB ThrottledRequests, DynamoDB write sharding, DynamoDB burst capacity, DynamoDB adaptive capacity, DynamoDB GSI throttling, DynamoDB BatchWriteItem, DynamoDB exponential backoff, DynamoDB ProvisionedThroughputExceededException, DynamoDB partition key design, DynamoDB partition splitting, DynamoDB on-demand vs provisioned, DynamoDB throttling root cause, DynamoDB CloudTrail analysis, DynamoDB conditional writes, DynamoDB idempotency, DynamoDB TTL throttling22 invocation_schema: 'Input: either (a) a table identifier + live-account context, (b) a CloudWatch metrics export (ThrottledRequests, ConsumedWriteCapacityUnits, ConsumedReadCapacityUnits), OR (c) table metadata (TableName, BillingMode, ProvisionedThroughput, GSIs, partition key attribute, TTL status) with observed throttling events. Output: a deterministic TARGET/VERDICT/REASON/RECOMMENDATION/ ESTIMATED_THROUGHPUT_IMPACT/MIGRATION_STEPS block per table, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.'23 invocation_example: "# Minimal valid input (offline classification):\nTableName: user-events-prod\nRegion: us-east-1\nBillingMode: PROVISIONED\nProvisionedThroughput:\n ReadCapacityUnits: 5000\n WriteCapacityUnits: 3000\nPartitionKey: user_id (String)\nGSI: event-type-index (partition key: event_type)\nTTL: not enabled\nMetrics (last 30 days):\n - ThrottledRequests: 45,000 (on Write)\n - ConsumedWriteCapacityUnits: avg 2800/s, max 3500/s\n - ConsumedReadCapacityUnits: avg 1200/s, max 1800/s\n - ReturnedItemCount: avg 50/scan\nThrottling pattern: spikes at top-of-hour batch writes (same user_id\n values concentrated in few partitions)\nEmit the standard optimization block (TARGET, VERDICT, REASON,\nRECOMMENDATION, ESTIMATED_THROUGHPUT_IMPACT, MIGRATION_STEPS)."24 version: 0.1.025 author: Jacky Chan — AWS Community Builder26 keywords: DynamoDB, throttling, hot partition, partition key, write sharding, burst capacity, adaptive capacity, GSI, batch write, BatchWriteItem, exponential backoff, jitter, provisioned vs on-demand, ProvisionedThroughputExceededException, ThrottledRequests, ConsumedWriteCapacityUnits, conditional writes, idempotency, TTL, partition splitting, CloudTrail, root cause analysis27 tags: dynamodb, databases, performance, throttling, partition-design, capacity, write-sharding28---2930# DynamoDB Throttling Optimizer3132## What this skill does3334Translates a DynamoDB table's throttling posture into a concrete35prevention recommendation with a throughput-denominated estimated impact.36The verdict is the highest-leverage action across eight dimensions --37partition key design, burst capacity, adaptive capacity, GSI distribution,38write capacity mode, batch write API, exponential backoff, and write39sharding -- applied in priority order. Always pairs the recommendation40with exact CLI commands.4142## Quick navigation4344| Section | What it covers | When to jump here |45|---|---|---|46| Quick start | Four headline rules and the throttling formula | First read |47| Mindset | Why partition key design is the #1 lever | Understanding the approach |48| Quick reference -- verdict thresholds | Decision matrix at a glance | Classifying a table |49| Pre-flight data gate | CloudWatch metrics, CloudTrail | Before any recommendation |50| Step 0 non-obvious behaviours | Burst capacity, adaptive capacity, GSI backpressure | Edge cases |51| Step 1 Partition key design | Hot partition detection, write sharding | The headline dimension |52| Step 2 Burst capacity | 300-second burst bucket utilization | Intermittent spikes |53| Step 3 Adaptive capacity | Automatic redistribution limits | Hot partition mitigation |54| Step 4 GSI distribution | Hot GSI partition key backpressure | GSI throttling |55| Step 5 Write capacity mode | Provisioned vs on-demand for bursty writes | Capacity mode decision |56| Step 6 Batch write API | BatchWriteItem for 16x throughput | High-volume writes |57| Step 7 Exponential backoff | ProvisionedThroughputExceededException handling | Client-side retry |58| Step 8 Impact estimation | Throughput math and worked examples | Every recommendation |59| Output format | VERDICT block + worked examples | Emitting the result |60| Anti-Patterns -- NEVER | Common misclassifications | Self-check before emit |61| Pre-flight safety checks | CONFIRM gate, GSI backfill | Before any apply CLI |6263## Quick start6465- **Partition key design is the #1 lever.** DynamoDB distributes data66 across partitions by partition key. A hot partition key (few distinct67 values, uneven write distribution) causes throttling even when total68 consumed capacity is below provisioned. Write sharding (random suffix)69 spreads writes across partitions.70- **Burst capacity gives a 5-minute window.** DynamoDB accumulates71 unused capacity (up to 300 seconds of provisioned throughput) and72 releases it as burst capacity. Intermittent spikes that fit within73 the burst window do NOT throttle. Sustained spikes beyond burst DO74 throttle.75- **Adaptive capacity is a safety net, not a design substitute.** When76 a hot partition exceeds its share of throughput, DynamoDB temporarily77 redirects unused capacity from cold partitions. This prevents78 immediate throttling but does not fix the underlying distribution79 problem. Rely on write sharding, not adaptive capacity.80- **BatchWriteItem is 16x more efficient than PutItem.** A single81 BatchWriteItem request writes up to 16 items (up to 16 MB) in one82 round trip. This reduces request count, network overhead, and83 consumed capacity per item. For high-volume writes, always use batch.8485## Mindset8687Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) - load on demand (see References below).8889## Quick reference -- verdict thresholds9091| Observation (14-30 day window) | Verdict | Recommendation |92|---|---|---|93| ThrottledRequests > 0 AND partition key cardinality is low (hot partition) | **FURTHER_OPTIMIZATION_AVAILABLE** (write sharding) | Step 1 -- add random suffix to partition key |94| ThrottledRequests > 0 AND burst capacity exhausted (sustained spikes > 5 min) | **FURTHER_OPTIMIZATION_AVAILABLE** (capacity mode) | Step 5 -- switch to on-demand OR increase WCU |95| ThrottledRequests > 0 AND GSI partition key is hot (GSI backpressure) | **FURTHER_OPTIMIZATION_AVAILABLE** (GSI design) | Step 4 -- redesign GSI partition key or use sparse index |96| Sustained writes > 1000 items/s AND using PutItem (not BatchWriteItem) | **FURTHER_OPTIMIZATION_AVAILABLE** (batch) | Step 6 -- migrate to BatchWriteItem |97| ThrottledRequests > 0 AND no exponential backoff on client | **FURTHER_OPTIMIZATION_AVAILABLE** (retry) | Step 7 -- implement backoff with jitter |98| BillingMode = PROVISIONED AND throttling on bursty, unpredictable writes | **FURTHER_OPTIMIZATION_AVAILABLE** (capacity mode) | Step 5 -- switch to on-demand |99| ThrottledRequests = 0 AND partition key well-distributed AND batch writes used | **OPTIMIZED** | Emit post-state verification |100| CloudWatch metrics absent or window < 14 days | **NEED_MORE_INFO** | Pull 14-30 day CloudWatch data, re-evaluate |101102## Pre-flight: data gate (run before any optimization decision)103104Throttling diagnosis requires CloudWatch metrics and table configuration.105Pull these before any recommendation. Full CLI sequences are in106`references/throttling-metrics-and-write-sharding.md`.107108Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) - load on demand (see References below).109110### Data-quality short-circuits111112| Condition | Effect on optimization |113|---|---|114| `ThrottledRequests` Sum = 0 over 14 days | Emit **OPTIMIZED** with note "no throttling observed." |115| `ConsumedWriteCapacityUnits` absent | **NEED_MORE_INFO**. Cannot assess write pressure. |116| Observation window < 14 days | **NEED_MORE_INFO**. Minimum 14 days; 30 days preferred. |117| Table `TableStatus != ACTIVE` | Skip optimization; surface as BLOCKED. |118| GSI `IndexStatus != ACTIVE` (backfilling) | GSI throttling expected during backfill; defer analysis. |119120## Process -- Optimization logic (apply in order)121122### Step 0: Non-obvious behaviours that change the recommendation123124Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) - load on demand (see References below).125126### Step 1: Partition key design (hot partition detection, write sharding)127128Partition key design is the #1 lever because DynamoDB distributes data129and throughput across partitions by partition key value. A hot partition130key (few distinct values, uneven write distribution) causes throttling131even when table-level consumed capacity is below provisioned.132133Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) - load on demand (see References below).134135**Hot partition diagnosis decision tree:**136```137Is ThrottledRequests > 0?138├── NO → No partition-level throttling. Check other dimensions.139└── YES → Is partition key cardinality high (>10,000 distinct values)?140 ├── NO → HOT PARTITION. Apply write sharding (Step 1).141 └── YES → Is write distribution even across keys?142 ├── NO → HOT PARTITION (skewed writes). Apply write sharding.143 └── YES → Check burst capacity exhaustion (Step 2) or GSI (Step 4).144```145146Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).147148Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).149150Use write sharding ONLY for genuinely hot keys. Over-sharding low-volume151keys adds read complexity without benefit.152153### Step 2: Burst capacity utilization154155DynamoDB accumulates unused provisioned throughput (up to 300 seconds)156as burst capacity. Understanding burst utilization is key to diagnosing157intermittent throttling.158159Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).160161**Diagnosis:**162163| Pattern | Root cause | Fix |164|---|---|---|165| Throttling only during brief spikes (<5 min) | Burst capacity exhausted | Increase WCU or switch to on-demand |166| Throttling during sustained writes (>5 min) | Provisioned too low | Increase WCU or on-demand |167| No throttling, burst heavily used | Near limit | Monitor closely, pre-provision |168169### Step 3: Adaptive capacity understanding170171Adaptive capacity automatically redistributes unused throughput from172cold partitions to hot partitions. It is a safety net, not a design fix.173174**Key facts:**175- Activates within seconds of a hot partition exceeding its share.176- Redirection is temporary (minutes), not permanent.177- Does NOT prevent throttling for sustained hot partitions.178- No configuration needed -- always on for provisioned tables.179180**Anti-pattern:** Designing a table with a known hot partition key and181relying on adaptive capacity to prevent throttling. Adaptive capacity182delays throttling; write sharding (Step 1) fixes it permanently.183184### Step 4: GSI partition key distribution185186GSI partition key design is as critical as base table partition key187design. A hot GSI partition key causes GSI throttling, which188back-pressures and throttles the base table.189190Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) - load on demand (see References below).191192**GSI optimization strategies:**193194| Problem | Fix |195|---|---|196| GSI partition key has low cardinality (e.g., `status` with 3 values) | Use composite key: `status#date` or write sharding |197| GSI is a "full table scan" pattern (all items under one key) | Redesign GSI partition key for distribution |198| GSI backfilling causes throttling | Reduce backfill rate or use on-demand temporarily |199| GSI is sparse but back-pressures base table | Ensure GSI partition key distributes writes evenly |200201### Step 5: Write capacity mode (provisioned vs on-demand)202203**Capacity mode decision matrix:**204205| Pattern | Recommended mode | Rationale |206|---|---|---|207| Steady, predictable traffic | Provisioned + auto-scaling | Lower cost; predictable capacity |208| Bursty, unpredictable traffic | On-demand | No throttling from capacity limits |209| Spikes >2x previous peak | Provisioned with headroom | On-demand 2x spike limit may throttle |210| Low traffic (<1000 WCU sustained) | On-demand | Simpler; no auto-scaling config needed |211| High traffic (>50,000 WCU sustained) | Provisioned | On-demand cost premium too high |212213Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).214215### Step 6: Batch write API (BatchWriteItem for 16x throughput)216217BatchWriteItem writes up to 16 items (up to 16 MB total) in a single218request. This reduces request count, network overhead, and client-side219latency.220221Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).222223Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).224225Moved verbatim to [references/error-handling.md](references/error-handling.md) - load on demand (see References below).226227### Step 7: Exponential backoff with jitter228229When `ProvisionedThroughputExceededException` occurs, the client must230retry with exponential backoff and jitter. The AWS SDK retries231automatically by default, but custom retry logic with jitter is more232effective for sustained throttling.233234Moved verbatim to [references/error-handling.md](references/error-handling.md) - load on demand (see References below).235236**Retry best practices:**237238| Strategy | When to use |239|---|---|240| SDK default retry (3 attempts) | Low-volume, occasional throttling |241| Custom backoff with jitter (10 attempts) | Sustained throttling, batch workloads |242| Adaptive retry (circuit breaker) | High-volume, latency-sensitive APIs |243244### Step 8: Conditional writes and TTL245246Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).247248Moved verbatim to [references/worked-examples.md](references/worked-examples.md) - load on demand (see References below).249250TTL reduces table size over time, which reduces storage cost and scan251time. TTL deletions consume background WCU -- stagger TTL values to252avoid batch-expiry throttling on provisioned tables.253254## Configuration dependency graph255256```257 ┌──────────────────────────┐258 │ ThrottledRequests > 0? │259 └────────────┬─────────────┘260 │261 ┌──────────────┴──────────────┐262 YES NO263 │ │264 ┌──────▼──────┐ ┌───────▼───────┐265 │ Partition │ │ Batch write │266 │ key hot? │ │ used? │267 └──────┬──────┘ └───────┬───────┘268 │ │269 ┌──────┴──────┐ ┌───────┴───────┐270 YES NO YES NO271 │ │ │ │272 ┌─────▼─────┐ ┌────▼────┐ ┌───────▼───┐ ┌───────▼───────┐273 │ Write │ │ GSI │ │ OPTIMIZED │ │ Check │274 │ sharding │ │ hot? │ │ │ │ capacity │275 │ (Step 1) │ └────┬────┘ └───────────┘ │ mode (Step 5)│276 └───────────┘ │ └──────────────┘277 YES │ NO278 │ └──→ Burst capacity (Step 2)279 ┌─────▼─────┐280 │ GSI │281 │ redesign │282 │ (Step 4) │283 └───────────┘284```285286Decision order: partition key (write sharding) -> GSI distribution ->287burst/capacity mode -> batch write -> exponential backoff.288289## Output format290291```text292TARGET: <table-name>293VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE294REASON: <1-2 sentences naming the recommendation and the supporting data>295RECOMMENDATION:296 Current: <billing-mode>, <WCU>, <partition key>, <GSI status>, <batch write status>297 Proposed: <billing-mode>, <WCU>, <partition key>, <GSI status>, <batch write status>298 Dimensions changed: <partition_key | burst | adaptive | gsi | capacity_mode | batch_write | backoff>299 Dimensions checked: <list ALL eight, each ✓ (no finding) or → (finding)>300 Confidence: <HIGH/MEDIUM/LOW> -- <one-line rationale>301ESTIMATED_THROUGHPUT_IMPACT:302 Current throttled requests/day: <count>303 Projected throttled requests/day: <count>304 Throughput improvement: <description>305 Root cause: <hot partition | burst exhaustion | GSI backpressure | insufficient capacity>306MIGRATION_STEPS:307 1. <specific action with CLI command>308 2. <verification step>309CONFIRM: Before executing any state-changing CLI, emit and await operator310 approval: "CONFIRM: About to <action> on <table-name> in <region>.311 Proceed? (yes/no)"312```313314Full worked examples are in `references/worked-examples.md`.315316## STRICT output contract317318The rules below are hard constraints. Self-check EVERY emitted block319against these rules before returning. Do NOT substitute markdown headings320or camelCase for the literal labels.321322### FORBIDDEN output patterns3233241. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with325 `Projected throttled requests/day` equal to current.** If every326 dimension nets zero improvement, verdict MUST be `OPTIMIZED`.3273282. **NEVER recommend write sharding without warning about read329 complexity.** Write sharding adds parallel read overhead. The330 MIGRATION_STEPS MUST note the read pattern change.3313323. **NEVER recommend on-demand mode without citing the cost premium.**333 On-demand is significantly more expensive than provisioned for334 steady workloads. Always pair with a cost-justification note.3353364. **NEVER recommend BatchWriteItem as a throttling fix without noting337 that consumed WCU is unchanged.** BatchWriteItem reduces request338 count, not consumed capacity. It helps with client-side latency and339 connection pool pressure, not partition-level throttling.3403415. **NEVER attribute throttling to insufficient capacity without checking342 partition key distribution.** Throttling is per-partition. A hot343 partition throttles even when table-level consumed < provisioned.344 Always check partition key cardinality and write distribution first.3453466. **NEVER omit a dimension from the RECOMMENDATION block.** The347 `Dimensions checked` line MUST list all eight dimensions.3483497. **NEVER emit scratch lines** ("WAIT -- recompute", "Hmm, let me redo")350 in the output.351352### Perfect example output -- FURTHER_OPTIMIZATION_AVAILABLE353354```text355TARGET: user-events-prod356VERDICT: FURTHER_OPTIMIZATION_AVAILABLE357REASON: PROVISIONED table with 45,000 ThrottledRequests on Write over 30358 days. Partition key (user_id) has high write skew -- top 1% of user_ids359 generate 80% of writes (detected via CloudTrail). Write sharding with360 random suffix (10 shards) will spread writes across 10 partitions,361 eliminating hot-partition throttling.362RECOMMENDATION:363 Current: PROVISIONED, 3000 WCU, pk=user_id (skewed), 1 GSI, PutItem364 Proposed: PROVISIONED, 3000 WCU, pk=user_id#NN (10 shards), 1 GSI, BatchWriteItem365 Dimensions changed: partition_key (Step 1) + batch_write (Step 6)366 Dimensions checked: partition_key → (shard) burst ✓ adaptive ✓367 gsi ✓ (well-distributed) capacity_mode ✓ batch_write → (migrate)368 backoff ✓ (SDK default active)369 Confidence: HIGH -- CloudTrail confirms 80/20 write skew on user_id.370ESTIMATED_THROUGHPUT_IMPACT:371 Current throttled requests/day: 1,500372 Projected throttled requests/day: 0373 Throughput improvement: 10x write capacity on hot keys (1 partition → 10)374 Root cause: hot partition (write skew on user_id)375MIGRATION_STEPS:376 1. Add sharding suffix to partition key on write:377 pk = f"{user_id}#{random.randint(1,10).zfill(2)}"378 2. Update reads to fan out across 10 shards in parallel:379 Query all 10 suffixes, merge results.380 3. Migrate high-volume PutItem calls to BatchWriteItem (16 items/batch):381 with table.batch_writer() as batch: ...382 4. Backfill existing items with sharded keys (one-time migration).383 5. Monitor ThrottledRequests for 7 days post-migration.384CONFIRM: About to apply write sharding (10 suffixes) to user-events-prod385 partition key. Read queries will need parallel fan-out. Proceed? (yes/no)386```387388**Self-check before emit:**389- [ ] All eight dimensions listed in `Dimensions checked`?390- [ ] Every `→` dimension has a corresponding MIGRATION_STEPS entry?391- [ ] Write sharding recommendation includes read-pattern warning?392- [ ] No scratch/recompute text in the block?393394## Verdict semantics395396| Verdict | When to emit |397|---|---|398| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete throttling-prevention recommendation. |399| `OPTIMIZED` | All dimensions pass (no throttling, partition keys well-distributed, batch writes used, backoff configured). |400| `NEED_MORE_INFO` | Data gate failed: ThrottledRequests metrics absent, window < 14 days, or CloudTrail unavailable. |401| `BLOCKED` | Hard precondition prevents evaluation: TableStatus != ACTIVE, GSI backfilling. |402403## Anti-Patterns -- NEVER (top 5)4044051. **NEVER recommend increasing WCU as the first fix for throttling.**406 Throttling is per-partition. A hot partition throttles regardless of407 table-level WCU. Always check partition key distribution first.4084092. **NEVER rely on adaptive capacity as a design strategy.** Adaptive410 capacity is a temporary safety net. It delays throttling for minutes;411 it does not fix sustained hot partitions. Write sharding is the412 durable fix.4134143. **NEVER recommend on-demand mode without citing the cost premium.**415 On-demand can be 3-5x more expensive than provisioned for steady416 workloads. Always pair with a cost-justification check.4174184. **NEVER recommend BatchWriteItem as a partition-level throttling fix.**419 BatchWriteItem reduces request count, not consumed capacity per item.420 It helps with client-side patterns, not partition-level hot-spot421 throttling.4224235. **NEVER add a GSI without checking its partition key distribution.**424 A hot GSI partition key causes GSI throttling, which back-pressures425 the base table. GSI partition key design is as important as base426 table partition key design.427428Extended anti-patterns in `references/error-handling-and-edge-cases.md`.429430## Expert heuristic431432Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) - load on demand (see References below).433434## Pre-flight safety checks (run before any remediation CLI)435436- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,437 emit and await operator approval.438- **Write sharding changes the partition key.** All reads must be439 updated to fan out across suffixes. Test read paths before deploying.440- **GSI changes require backfill time.** Creating or modifying a GSI441 takes minutes to hours depending on table size. Plan for backfill.442- **Capacity mode switch is instant but has implications.** Provisioned443 to on-demand is instant; on-demand to provisioned requires setting444 WCU/RCU. Test auto-scaling after switching to provisioned.445- **BatchWriteItem migration requires code changes.** Ensure the client446 handles `UnprocessedItems` correctly.447- **TTL activation has a delay.** TTL deletions begin within 48 hours448 of enabling. Stagger TTL values to avoid batch-expiry throttling.449- **Bulk-operation limit:** 5 tables per batch. Sort by ThrottledRequests450 count.451452## Recent AWS features (2024-2026)453454Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) - load on demand (see References below).455456## References457458- `references/throttling-metrics-and-write-sharding.md` -- CloudWatch459 metrics reference, write sharding patterns, BatchWriteItem examples,460 exponential backoff code, capacity mode decision matrix, GSI461 distribution analysis, partition splitting strategies.462- `references/worked-examples.md` -- write sharding migration, GSI463 redesign, capacity mode switch, batch write migration, already-464 optimized, NEED_MORE_INFO, end-to-end walkthrough.465- `references/error-handling-and-edge-cases.md` -- CLI/data-source466 failure handling, GSI backfill edge cases, TTL batch-expiry467 throttling, extended NEVER list, partition splitting guidance.468469## References (load on demand)470471- [references/advanced-patterns.md](references/advanced-patterns.md) — Mindset five principles, Step 0 non-obvious behaviours, expert heuristic, and 2024-2026 feature changes moved from SKILL.md472- [references/diagnostic-commands.md](references/diagnostic-commands.md) — Pre-flight data-gate sources plus hot-partition and per-GSI ThrottledRequests metric commands moved from SKILL.md473- [references/error-handling.md](references/error-handling.md) — ProvisionedThroughputExceededException backoff-with-jitter code and BatchWriteItem UnprocessedItems retry handling moved from SKILL.md474- [references/worked-examples.md](references/worked-examples.md) — write-sharding, burst-math, capacity-mode-switch, batch-write, conditional-write and TTL code patterns moved from SKILL.md (extends the existing worked examples)475476## Domain477478AWS CloudOps / DynamoDB Throttling Prevention & Partition Key Optimization.479480## AWS documentation481482- **DynamoDB Developer Guide** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Welcome.html483- **DynamoDB partition key design** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html484- **DynamoDB burst capacity** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/burst-capacity.html485- **DynamoDB adaptive capacity** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-adaptive486- **DynamoDB BatchWriteItem** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html#WorkingWithItems.BatchOperations487- **DynamoDB error handling** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Programming.Errors.html488- **DynamoDB capacity modes** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html489- **DynamoDB GSI** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html490- **DynamoDB TTL** -- https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html491- **AWS CLI DynamoDB reference** -- https://docs.aws.amazon.com/cli/latest/reference/dynamodb/492- **Well-Architected -- Performance Efficiency** -- https://docs.aws.amazon.com/wellarchitected/latest/performance-efficiency-pillar/welcome.html