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

feita há 2 anos766 visualizações
3 Respostas
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
ESPECIALISTA
Uri
respondido há 2 anos
  • 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?

respondido há 2 anos
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.

ESPECIALISTA
respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas