1 Answer
- Newest
- Most votes
- Most comments
1
There are a few things you can do:
- Increase the batch size. This will reduce your cost as well as your processing time. By setting a large batch size, Lambda does not wait until all the messages arrive (unless you also set a batch window). There are fewer invocations, fewer overhead, and further more, you can use batch operations when writing to the destination database, which will reduce your duration event further. You can also create threads in your function to handle the messages in the batch in a parallel manner.
- Set the Parallelization Factor to 10. This will give you a concurrency of 10 instead of 1 for each DDB partition. By doing this alone, you will probably see a 10x decrease in processing time.
Relevant content
- Accepted Answerasked 8 months ago
- asked 4 months ago
- asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- How can I use a Lambda function to automatically start an AWS Glue job when a crawler run completes?AWS OFFICIALUpdated 2 years ago
Yes. You want to quickly move a pile of rocks, right, but you're putting just 1 rock in your wheelbarrow at a time and assigning just 1 wheelbarrow per partition. Load more rocks each time and have more wheelbarrows to take turns. You may be thinking a batch size of 100 means it sits there waiting until it sees the 100th arrive (like an airport shuttle bus) but no, it starts off after a certain short time even if the 100 isn't reached.