0
votes

Right now I have mobile apps hitting a serverless aws lambda endpoint, writing 1 record. At times, the mobile app writes several of these records over and over again (50-300). An example of what 1 record looks like can be seen below:

    {
      "name": "John Doe",
      "miscValue": "1f2ea989-5b33-49e5-a88a-19c7594afd9d",
      "ratio": "1.7777777777777777",
      "new": true,
      "timestamp": "1524156952325"
    }

Now, if I change it, so that instead of writing 1 record per lambda call, it can write multiple records per call, and then do fewer calls, would that result in a lower dynamodb throughput?

Example Scenario:

The app could write 1 record per second for 100 seconds vs 10 records per second for 10 seconds.

AWS Documentation states:

One write capacity unit represents one write per second for an item up to 1 KB in size. If you need to write an item that is larger than 1 KB, DynamoDB will need to consume additional write capacity units. The total number of write capacity units required depends on the item size.

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

This leads me to believe, that since my record size is well under 1kb, if I made the change to do multiple records at a time I would see a signficant improvement in dynamodb throughput utilization. Is that correct?

1

1 Answers

2
votes

One write capacity unit represents one write per second for an item up to 1 KB in size

No matter how you do it if you provision 1 write unit on the table you are allowed to write 1 item per second (besides burst capacity https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html#bp-partition-key-throughput-bursting). In case the item is bigger than 1 KB, you need more then 1 write unit (ceil(size / 1KB)) to write it. If the item is smaller than 1 KB you anyway need 1 write unit.