- 新しい順
- 投票が多い順
- コメントが多い順
When you have multiple SQS queues added as triggers to a Lambda function, the behavior you're describing doesn't occur. Each SQS queue trigger operates independently, and Lambda doesn't automatically poll other queues when it's invoked by one specific queue.
Here's how it works:
-
When a message arrives in one of your SQS queues, it triggers the associated Lambda function for that specific queue.
-
Lambda processes the messages from the queue that triggered it, but it doesn't automatically check or poll the other queues that are set up as triggers.
-
Each SQS queue trigger has its own event source mapping, which is responsible for polling its specific queue and invoking the Lambda function when messages are available.
The "NumberOfEmptyReceives" metric indicates the number of ReceiveMessage API calls that did not return any messages. This metric increasing doesn't necessarily mean your Lambda function is polling empty queues. Instead, it could indicate that:
- The SQS service itself is polling the queue but not finding messages.
- There might be other consumers of the queue besides your Lambda function.
- The Lambda service is scaling down and checking for messages less frequently when the queue is empty for a while.
To troubleshoot the alarm breach:
- Check if there are other consumers of the queue besides your Lambda function.
- Review your Lambda function's concurrency settings and scaling behavior.
- Examine the message processing patterns and ensure messages aren't being deleted before they can be processed.
- Consider adjusting your alarm threshold if the current setting is too sensitive for your use case.
Remember, Lambda's behavior with SQS is designed to be efficient, only invoking the function when there are actual messages to process. The alarm breach you're seeing is likely not caused by Lambda unnecessarily polling empty queues.
Sources
Using Lambda with Amazon SQS - AWS Lambda
Understanding SQS retries - AWS Lambda
Simple Queue Service (SQS) - Incident Detection and Response Alarming Best Practices | AWS re:Post
関連するコンテンツ
- 質問済み 7ヶ月前
- 質問済み 7ヶ月前
