I have an
- SQS queue with a batch size of 1
- Lambda function with a reserved concurrency of one
- Lambda is configured to listen on the queue and do some work when messages arrive. Said work typically takes around 8-12 seconds, never more than 15.
- Emphasis on "listening", so I'm not polling with a Lambda, but instead the Lambda gets triggered by the SQS queue automatically.
I pump 10 messages into the queue and expect the lambda to go through them one by one in reasonable (linear) time given that the reserved concurrency is exactly 1 around 150 seconds maximum in total.
What happens is that the first few messages get processed in reasonable time and then some extreme slowness kicks in (15 minutes of no visible progress). The SQS queue claims that all 10 messages are "in flight", basically putting the blame on the Lambda or the code running inside of it.
Has anybody experienced behavior like this and if yes did they ever figure out why?
Edit The same issue presents itself under different tests as well. For example when the reserved concurrency was 70, and then 700 messages were pumped into the queue (all at once, e.g. at machine speed) and the 698th message took around 10-15 minutes to get a Lambda to process it. I verified through logging that the execution of the code inside the Lambda does not take 10-15 minutes (just the usual 8-12 seconds) so everything seems to be pointing towards Lambda functions not getting allocated as they should, but I have no way of proving/disproving this at present.