Search code examples
amazon-dynamodbthrottlingondemand

How can I check the item size of a request in dynamodb?


We are using a dynamodb with on-demand capacity mode. We are suddenly seeing few of our requests getting write throttled. During the same time frame there is sudden spike in Write Capacity Units (WCU).

I have checked the incoming traffic/ write request count and it is pretty much the same.

  1. Does this mean the WCU increase is due to increase in item size?
  2. How can I verify the size of my request?
  3. Since our dynamodb is already provisioned in on-demand mode, why is it unable to auto scale and handle the requests given that traffic is pretty much the same.

Solution

    1. It's possible

    2. You can return the consumed capacity for each write operation which will allow you to understand which items are consuming more capacity. ReturnConsumedCapacity

    3. On-demand mode tables can throttle for 3 reasons:

      • You exceed twice your previous peak in 30 mins
      • You exceed partition hard limit of 1000 WCU / 3000 RCU (hot partition)
      • You have GSI backoressure where you're GSI has a hot partition

    You can enable CloudWatch Contributor Insights to understand if you have a hot key(s).