I've read in multiple places that sqs use of minimum 5 pollers simultaneously to pull messages from queue. So if there's aren't sufficient available consumers (I'm using lambdas), then a message will be throttled and get back to the queue. And It's therefor recommended to set visibility timeout 6 times of the process time (Or lambda timeout). The thing that i fail to understand - When there's polling of a message from the queue without available consumer - During that visibilityTimeout window will the message still be assigned to a consumer that gets available? Or once throttled it gets back to the queue right away. I just fail to understand the entire logic behind visibilityTimeout configuration had would appreciate explanation in this matter. If I need that a message that was pulled from queue but no availble consumer to take it at the moment- How can i set it to be back to be picked straight away? This is not a Fifo queue. Thanks
I can see i have throttled messages and not sure if im configured properly (Im with concurrency of 12, lambda timeout set to 60 and visibilityTimeout also 60 right now)
The lambda service gets the message(s) from the queue and then tries to invoke a lambda function with that message. There are couple of things that can happen:
Because you cannot know if your lambda will ever be throttled you must assume it will be throttled, therefore you must ensure that even the 5 retires and a potential execution in the last retry all happen within the configured visibility timeout: therefore visibility timeout = 6 * lambda timeout.
If you incorrectly configure the visibility timeout the message might become visible while the lambda (service) is already / still working on it leading to multiple executions of the same message.