Why is AWS::Lambda::EventInvokeConfig's limit for MaximumRetryAttempts 2?

0

The documentation [1] states that MaximumEventAgeInSeconds can be up to 6 hours long. However, because MaximumRetryAttempts only goes up to 2 retries, the end result for an asynchronous invocation's age can only be about 3 minutes in practice. How can I use more of that age in seconds limit with only 2 retries?

[1] https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventinvokeconfig.html#cfn-lambda-eventinvokeconfig-maximumretryattempts

已提問 2 年前檢視次數 766 次
3 個答案
0

When you invoke a function asynchronously, the event is added to an internal queue and then the Lambda service gets the messages from the queue and invokes the function. It will try to invoke the function up to a maximum of 3 times (2 retries - configurable) and if it fails, it will send the event to a DLQ (if configured).

For different reasons, it may be that the event will remain in the queue and will not be handled immediately. In that case you can configure the max event age (up to the max of 6 hours, which is the default). If the event remains in the queue for longer that specified, it wil be dropped.

profile pictureAWS
專家
Uri
已回答 2 年前
  • I am sorry, this is not an answer to the question. At best, perhaps your hand wave "different reasons" was an attempt. Could you please expand and re-read my question:

0

Thanks, I appreciate the help. Sadly this is the answer (throttling) I was dreading and it means I can not do an easy exponential backoff [1] [2] for myself and the AMQP replacement with EventBride -> Lambda (w/Destinations) system I am building.

If Destinations allowed me to have MaximumRetryAttempts more than 2 I could get something similar (up to 6 hours) to the service-level behavior for my client code. Building code like (https://bitesizedserverless.com/bite/async-lambda-function-retries-with-backoff-and-jitter/) is not a solution. All we need is more attempts.

system errors (500-series), Lambda returns the event to the queue and attempts to run the function again for up to 6 hours

Just to make sure, when you say "system" you mean AWS service, not my client side 500 errors right?

已回答 2 年前
0

I know it's confusing because there are two types of retries. Uri correctly pointed out that the age limit in the queue and retry limit are for different reasons, it's not about those retries "using that limit". As in https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html, retries (max 2) are for when your function returns an error. The age limit is for this situation where many more than 2 retries may occur:

If the function doesn't have enough concurrency available to process all events, additional requests are throttled. For throttling errors (429) and system errors (500-series), Lambda returns the event to the queue and attempts to run the function again for up to 6 hours. The retry interval increases exponentially from 1 second after the first attempt to a maximum of 5 minutes. If the queue contains many entries, Lambda increases the retry interval and reduces the rate at which it reads events from the queue.

專家
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南