Thunderbolt Engineer
Thunderbolt Engineer

Reputation: 1563

Synchronous lambda invocation - what happens when it is throttled?

I have 2 lambda functions running on the platform. Lambda A invokes the Lambda B synchronously to use its response for the further processing. It would work well in normal situation but what happens if the lambda concurrent execution limit is met? Here is what I can read from the AWS docs:

Clients such as the AWS CLI and the AWS SDK retry on client timeouts, throttling errors (429), and other errors that aren't caused by a bad request (500 series). For a full list of invocation errors, see Invoke.

But I am not sure how often/how many times they would retry. Do I need to add a logic to the lambda A to retry with a certain interval when it gets 429 response? If anyone has insight into this problem, please help me.

Upvotes: 2

Views: 912

Answers (1)

Chris Williams
Chris Williams

Reputation: 35213

Generally the SDKs will use exponential backoff to reattempt trying to invoke the Lambda function. As you're invoking from another Lambda function this may lead to increased invocation time or timeouts from the original Lambda.

One suggestion for handling chaining of Lambda functions would be to replace the functionality of a Lambda calling another Lambda with the use of AWS Step Functions.

The AWS Step Functions service allows you to build a state machine, which in your case would allow you to build a workflow where the output of Lambda A is then passed to Lambda B, with built in logic for handling retries and failures.

For more information on this approach take a look at the Create a Serverless Workflow documentation.

Upvotes: 2

Related Questions