Closed arunmr1980 closed 2 years ago
Yes, by default there is unlimited concurrency to the executions.
As per documentation
The default value is 0, which places no quota on parallelism and iterations are invoked as concurrently as possible.
This can limited using MaxConcurrency field configuration
https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html
Are you trying to invoke 10 lambdas at a time to process 10 messages @arunmr1980 ?
That is the default behavior of step function loops. It spin off as many lambda invocations as there are elements in the list. This behavior can be controlled by MaxConcurrency field. Say if we set that to 5, it will process 10 messages in 5 invocations, so each lambda function will process 2 messages.
This is how lambda handles multiple events. From the doc
When a function is first invoked, the Lambda service creates an instance of the function and runs the handler method to process the event. After completion, the function remains available for a period of time to process subsequent events. If other events arrive while the function is busy, Lambda creates more instances of the function to handle these requests concurrently.
https://docs.aws.amazon.com/lambda/latest/operatorguide/scaling-concurrency.html
No, this will defeat the purpose of batch processing. What I meant by parallelization was, from python itself we can call aws send mail in separate thread instead of directly calling it inside for loop. From one lambda only that should be possible to do asynchronous API calls.
I suppose you are looking for multithreaded code. This can be done in python. Here are the pros and cons of that approach.
Pros
Cons
Since the actual email sending code is pretty simple and not resource intensive, I think the multithreaded approach will work as good.
Use map to send emails