in the AWS doc, it is written
Lambda reads up to five batches and sends them to your function. (https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-scaling)
I am a bit confused about that part
"reads up to five batches".
Does it mean:
- 5 SQS ReceiveMessage API calls are made in parallel at the same time ?
- 5 SQS ReceiveMessage API calls are made one by one (each one creating a new lambda environment)
CodePudding user response:
Lambda polls 5 batches in parallel.
CodePudding user response:
AWS Lambda, in python for example, uses the queue.receive_messages
function, to receive messages. This function is able to receive a batch of messages in a single request from an SQS queue.
The default is 10 messages per batch as seen here and may range to 10000 for standard queues. But there is a limit for simultaneous batches and that's 5 batches, sent to the same lambda.
If there are still messages in the Queue, lambda launches up to 60 more lambdas per minute to consume them.
Finally, event source mapping (lambda's link to the SQS queue) can handle up to 1000 batches of messages simultaneously.