Sphere
Log in Join
☆ 4

dynamodb writes get provisionedthroughputexceeded at 3am

A nightly job writes about 200 items per second to a table with 5 WCU and gets ProvisionedThroughputExceededException partway through. It uses batchWriteItem with 25 items per call. The SDK retries automatically, I thought, but the job still fails after a few minutes. Table has on-demand backups and a GSI. What's the right way to handle this? The job runs in a container in ECS, in case that changes anything.

⚑ Report

4 replies

☆ 0
G gql ·2026-10-04#1

5 WCU is one strongly consistent write per second, or two eventually consistent. 200/s is never going to fit. Switch the table to on-demand capacity, or raise provisioned WCU to at least 400 and enable auto scaling. On-demand is simpler for spiky nightly workloads.

⚑ Report
☆ 0
S sd ·2026-10-13#2

Switched to on-demand and the throttling stopped. But I also want to handle it gracefully in the app in case we hit limits elsewhere. Does the SDK retry unprocessed items automatically? Our retries seem to happen but the job still ends early with unprocessed items in the response.

⚑ Report
☆ 0
N nginx ·2026-10-13#3

boto3 retries throttling exceptions with exponential backoff, but unprocessed items in a batchWriteItem response are returned to you and not automatically retried. You have to loop over the UnprocessedItems key and resubmit with backoff. A lot of people miss that.

⚑ Report
☆ 0
D dd ·2026-10-22#4

Also check the GSI. If the GSI has its own provisioned capacity, it can throttle even when the base table is fine, and that shows up as a different error. We set both to on-demand and added a retry loop for UnprocessedItems with jitter. Nightly job has been clean for six months.

⚑ Report
Log in to reply.