Let say APIGateway triggers a function(handler) which awaits 10 secs
public async Task<APIGatewayProxyResponse> Get(APIGatewayProxyRequest request, ILambdaContext context){
var x = await Wait10Async();
return SomeAPIGatewayProxyResponse;
}
Q1: What happens to this container(execution environment) when awaitreturns the control flow to the function handler itself? Obviously Lambda waits for Task to complete before returning to the APIGateway, but during this 10 sec does the container(or whatever) accept and execute more Get functions?
The reason behind the question is AWS Lambda has 1000 concurrent execution limitations and it said every execution runs in separate containers therefore it makes me question this scenario:
1 - APIGateway receives 1000 simultaneous request and starts 1000 Lambda handlers which completes after 10 seconds
2 - 3 second after the first requests(before they complete) another let say 100 request come to APIGateway. All lambda containers are exhausted in this case.
Is this what happens or await has a magic to solve this? I know how await doesn`t block the loop in classic view applications. But how does it behave in Lambda execution environment?