How to Reduce DynamoDB Throttling Issues

published on 21 April 2025

Throttling happens when your DynamoDB table or index can't handle the number of requests being made. This leads to failed operations, slower responses, and a bad user experience. Here's how to fix it:

  • Monitor Capacity Usage: Use CloudWatch to track ThrottledRequests and ensure your provisioned Read/Write Capacity Units (RCUs/WCUs) match your workload.
  • Balance Data Distribution: Avoid "hot partitions" by using high-cardinality partition keys and spreading traffic evenly.
  • Optimize Queries: Use targeted queries instead of full table scans and fetch only the data you need.
  • Enable Auto-Scaling: Dynamically adjust RCUs and WCUs to handle traffic spikes.
  • Retry with Backoff: Implement exponential backoff for retries to reduce pressure during throttling events.
  • Set Alerts: Configure CloudWatch alarms to notify you of throttling issues before they escalate.

Common Causes of DynamoDB Throttling

DynamoDB

Pinpointing the reasons behind throttling helps you address issues and improve monitoring.

High Traffic and Limited Capacity

When requests exceed the provisioned Read Capacity Units (RCUs) or Write Capacity Units (WCUs), DynamoDB responds with throughput-exceeded errors. This often happens due to:

  • Sudden traffic spikes during peak usage times or special events
  • Provisioned RCUs or WCUs being set too low for the workload

Uneven Data Distribution

Imbalanced partition key usage can lead to "hot partitions", even if the overall capacity seems sufficient. This occurs when:

  • Partition keys are sequential or monotonic, like timestamps
  • There aren't enough unique partition keys
  • Access patterns repeatedly target the same items

Resource-Heavy Queries

Poorly optimized queries can consume excessive capacity and cause throttling. Common culprits include:

  • Performing full table scans instead of using key-condition queries or indexed lookups
  • Retrieving large datasets in a single operation
  • Relying on filter expressions instead of key conditions to narrow results

To address these issues, consider using secondary indexes, breaking results into smaller pages, applying key conditions before filters, and keeping a close eye on query patterns.

Once you understand these causes, use CloudWatch metrics to measure throttling events and identify problem areas more precisely.

Finding and Measuring Throttling Issues

Key CloudWatch Metrics to Monitor

CloudWatch

CloudWatch can help you identify throttling problems by tracking specific metrics. Focus on these:

  • ThrottledRequests: Alerts you to throttling events.
  • ConsumedReadCapacityUnits and ConsumedWriteCapacityUnits: Show how much capacity your application is using.
  • ProvisionedReadCapacityUnits and ProvisionedWriteCapacityUnits: Indicate the capacity you’ve allocated.

Set up alerts for any non-zero ThrottledRequests or when consumption approaches the provisioned capacity. To pinpoint issues, dive deeper into partition-level metrics to find "hot" partitions.

Identifying Partition-Level Performance Issues

Sometimes, table-level metrics look fine, but throttling may still occur due to uneven load distribution across partitions. To uncover these "hot" partitions, compare capacity usage per key:

  • Check per-key ConsumedReadCapacityUnits and ConsumedWriteCapacityUnits for imbalances.
  • Look for partition keys consuming much higher throughput than others.

If you spot uneven usage, consider redistributing the load. This could involve redesigning your partition key or implementing sharding to spread the load more evenly.

Distinguishing Database vs. Application Issues

Not all throttling problems are database-related. Here's how to tell the difference:

  • Database Issues: If ConsumedCapacity consistently matches or exceeds ProvisionedCapacity, you may need to increase capacity, enable auto-scaling, or set up alarms for ThrottledRequests and high capacity usage.
  • Application Issues: Look for inefficiencies such as large batch operations, poorly optimized queries, or skewed access patterns. Adjust your application logic to reduce these bottlenecks.
sbb-itb-6210c22

Methods to Reduce Throttling

Error Handling with Backoff

Pair capacity and partition adjustments with retry mechanisms to handle temporary traffic spikes effectively.

One approach is to use exponential backoff when retrying after a ProvisionedThroughputExceededException. Here's how:

  • Adjust the base delay and maximum retries based on how often throttling occurs.
  • Quickly stop retries for errors unrelated to throttling to identify and address issues promptly.
async function retryWithBackoff(call, maxRetries = 3, baseDelay = 100) {
    let retryCount = 0;
    while (retryCount < maxRetries) {
        try {
            return await operation();
        } catch (error) {
            if (error.code === 'ProvisionedThroughputExceededException') {
                retryCount++;
                const delay = baseDelay * Math.pow(2, retryCount);
                await new Promise(resolve => setTimeout(resolve, delay));
            } else {
                throw error;
            }
        }
    }
}

This method ensures a balance between retrying enough to handle temporary issues and avoiding excessive delays for unrelated errors.

Preventing Future Throttling

Stay ahead of throttling issues by using monitoring tools, setting up alerts, and fine-tuning your access patterns.

Regular Usage Reviews

Keep an eye on CloudWatch metrics to track how your capacity usage compares to the provisioned limits. Pay special attention to metrics like ThrottledRequests and look for unusual spikes or gradual increases in load by comparing current usage with historical trends.

Setting Up Alerts

Configure CloudWatch alarms to track ThrottledRequests. Set thresholds that align with your performance goals and ensure your team gets notified promptly through email or SMS when these thresholds are crossed.

Improving Access Patterns

Refine your access patterns to balance the load and avoid bottlenecks:

  • Request only the attributes you need.
  • Design partition keys that spread traffic evenly.
  • Replace full table scans with specific, targeted queries.

These adjustments can help your system handle traffic more efficiently and reduce the chances of throttling.

Summary

Reduce DynamoDB throttling by focusing on monitoring, capacity management, and efficient design strategies.

  • Enable auto-scaling for Read and Write Capacity Units (RCUs and WCUs) to adjust capacity automatically.
  • Set up CloudWatch alarms to monitor metrics like ConsumedCapacity and ThrottledRequests.
  • Use high-cardinality partition keys to distribute data evenly and mitigate hot partitions.
  • Apply exponential backoff for retries to prevent overwhelming the system during throttling.
  • Review usage patterns regularly to identify and address inefficiencies.

Related posts

Read more