Reputation: 18157
Does AWS maintain a thread-pool and dispatch concurrent incoming requests to the same Lambda instance, or spin up another instance in these circumstances?
I know that at some load factor another instance will be started, but can I rely on single-threaded access within a Lambda?
Upvotes: 6
Views: 135
Reputation: 33749
A Lambda instance processes one event at the time. If more events arrive before the event is processed, a new instance is spawned. Copied from the AWS Lambda developer guide:
The first time you invoke your function, AWS Lambda creates an instance of the function and runs its handler method to process the event. When the function returns a response, it sticks around to process additional events. If you invoke the function again while the first event is being processed, Lambda creates another instance.
Upvotes: 1