batch window lower than 20s but lambda function is called in 20s interval

0

In lambda manual, there is:

If you're using a batch window and your SQS queue contains very low traffic, Lambda might wait for up to 20 seconds before invoking your function. This is true even if you set a batch window lower than 20 seconds.

What is the cause behind this? I asked chatGPT and Bard, but neither of them could give me a solid answer.

  • How is your visibility timeout configured?

  • It's 30 seconds by default

asked 3 months ago133 views
1 Answer
0
Accepted Answer

I think I get the root cause. Lambda is using long polling to get messages from SQS. it will wait for the message for up to 20 seconds. So even if there is no message during that time and a shorter batch window like 2 seconds has been set, the function will be invoked after 20 seconds with an empty message.

I will vote myself :-)

answered 3 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions