aws throttling_error ai_generated partial

An error occurred (ProvisionedThroughputExceededException)

ID: aws/dynamodb-provisioned-throughput-exceeded

Also available as: JSON · Markdown
82%Fix Rate
85%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

DynamoDB read/write capacity exceeded. Too many requests per second.

generic

Workarounds

  1. 90% success Switch to on-demand capacity mode for unpredictable workloads
    aws dynamodb update-table --table-name MyTable --billing-mode PAY_PER_REQUEST
    
    On-demand mode auto-scales to handle any traffic level. No capacity planning needed, but costs ~6x more per request than provisioned at steady state.

    Sources: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html

  2. 88% success Implement exponential backoff for throttled requests
    import boto3
    from botocore.config import Config
    
    config = Config(retries={'max_attempts': 10, 'mode': 'adaptive'})
    dynamodb = boto3.resource('dynamodb', config=config)
    
    Adaptive mode automatically adjusts retry delays based on throttling response headers.

    Sources: https://docs.aws.amazon.com/general/latest/gr/api-retries.html

  3. 85% success Review partition key design — hot partitions cause throttling even with capacity
    Check CloudWatch ConsumedReadCapacityUnits/ConsumedWriteCapacityUnits per partition:
    aws cloudwatch get-metric-statistics --namespace AWS/DynamoDB --metric-name ConsumedWriteCapacityUnits --dimensions Name=TableName,Value=MyTable --period 300 --statistics Sum --start-time 2024-01-01T00:00:00Z --end-time 2024-01-01T01:00:00Z
    
    Use high-cardinality partition keys (e.g., userId, orderId) instead of low-cardinality keys (e.g., status, date). Add a random suffix to spread writes: partitionKey = userId + '#' + random(1,10).

    Sources: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html

Dead Ends

Common approaches that don't work:

  1. Increase capacity to maximum immediately 60% fail

    Expensive and doesn't address the access pattern issue

Error Chain

Frequently confused with: