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년 전767회 조회
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년 전

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

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

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

관련 콘텐츠