Search code examples
amazon-dynamodb

DynamoDb provisioned capacity, high batch get volume


How should one calculate the read unit capacity for DynamoDb? Here is the use case:

API that needs to retrieve 1000 - 10,000 records per request. No relational processing, simply key based. <1000 requests are expected per day, however, latency is important. So DynamoDb configuration needs to retrieve 10,000 records in < 1 second.

Each record has 5 string attributes, with keys of length 6 and values of length 8 (ex {'pk_123': 'abcdefgh', ...})

Naively, my guess is 1k min, 10k max read unit capacity w/ autoscaling on and target utilization at 70%.


Solution

  • A simple calculation would be the following

    10000rps / 4kb / 2(eventually consistent) = 1250

    So if you're consistent throughput is 10k RPS then 1250 RCU is what you'll consume.

    Setting a min will depend on how often you ramp down and how sharp its required to ramp up. If you have steady traffic always above 1k, then a good base would be 1k. However, if you have long periods of no traffic, it could be wasteful.

    One thing I always ask people to do is to use on-demand for a short period, and then you can make much better decisions knowing your access patterns and throughput consumption.