2 Answers
- Newest
- Most votes
- Most comments
2
Concurrency is achieved by 2 factors:
- The number of partitions in your DynamoDB table
- The parallelization factor of your Lambda function
I'm guessing your DynamoDB table has a single partition, which results in a single shard in the stream, and thus a single Lambda invocation. To increase concurrency you can do the following:
- Increase your WCU on your DynamoDB table to 40,000 WCU and when the table is
active
, reduce it to your working capacity needs. This will increase the partitions and ultimately increase the parallelization. - Increase the Parallelization Factor to a value up to a max of 10. That is for every shard in the stream you can have 10X Lambdas invoked.
0
You can use the AWS SDK for Node.js or Python to handle the stream events and invoke other Lambda functions asynchronously. And have you check to make sure your function is not meeting any memory or time limits. And I'm sure that you're already using the step function.
answered a year ago
What, this makes absolutely no sense?
Relevant content
- Accepted Answerasked 2 years ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 months ago
Thank you much, Leeroy - I think you are right that my assumption about having multiple partitions (due to sparse partition key) was incorrect. I tried setting the Parallelization Factor to 10 and saw concurrency happening (which I could have sworn I tried before and it didn't work). I wish there was an easy way to know in real time how many partitions my table has, especially since we are using on-demand capacity. Thanks again for your answer!
You can understand how many partitions you have by reading your DynamoDB Stream shards. List the shards in your stream, loop over them and count the ones which are marked as
Active
, this will be the number of partitions you have in your table.