Avoiding throttling issues altogether using asynchronous Lambda invocation

0

On an account that has a limit of 10 concurrent invocations limit, I have noticed that calling the Lambda function synchronously in short intervals can cause throttling issues (502 errors - some requests are simply rejected due to limit reach).

However, if the same function is called multiple times at very short intervals asynchronously (using InvocationType: Event), then all succeed.

My question, is this a feasible way to avoid all those throttling issues altogether ? Simply calling the function asynchronously ? Would this work always flawlessly,

Thank you.

WM
질문됨 일 년 전544회 조회
2개 답변
1
수락된 답변

It is possible that using the asynchronous InvocationType (Event) when calling a Lambda function can help to avoid throttling issues in cases where the concurrent invocations limit has been reached. This is because the Event invocation type allows multiple requests to be handled concurrently, whereas the default RequestResponse invocation type processes requests one at a time.

However, it is important to note that using the Event invocation type may not always work flawlessly to avoid throttling issues. This is because the Event invocation type is not guaranteed to deliver the results of the function in the order that the requests were made. Additionally, the Event invocation type may not be suitable for all use cases, as it does not provide a way to obtain the result of the function directly.

In general, it is a good practice to design your Lambda functions and the calling application in a way that avoids reaching the concurrent invocations limit. This can be done by using techniques such as batching requests, or by using a queueing service such as Amazon SQS to buffer requests before they are sent to the Lambda function.

profile pictureAWS
답변함 일 년 전
profile picture
전문가
검토됨 한 달 전
  • Thank you, that was very informative.

1

Any reason you want such a low limit on concurrent invocations when your question is about running more at once? You can request a quota increase? Am I missing something that makes you need a different solution?

I do agree with Dylan's answer that async behaves a bit differently and would be the preferred design pattern.

profile picture
답변함 일 년 전
  • I understand that increasing the limit solves the issue for concurrent invocations (synchronously). Another solution, I understand, is to use asynchronous invocations, order does not matter. What matters is that all requests will be processed. And there is also the dead lock feature, which can notify about failed ones. Amazon SQS or batching from my side can also be a third solution. Thank you, your input is valuable.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠