aws-lambda-sqs | Sample AWS Lambda with SQS using Spring Cloud Function | AWS library
kandi X-RAY | aws-lambda-sqs Summary
kandi X-RAY | aws-lambda-sqs Summary
Sample AWS Lambda with SQS using Spring Cloud Function
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- This method deletes all SQS queue messages
- Delete messages by queueUrl
- Gets a list of messages from SQS
- Launches the application
- The default client
- The Amazon SQS client
aws-lambda-sqs Key Features
aws-lambda-sqs Examples and Code Snippets
Community Discussions
Trending Discussions on aws-lambda-sqs
QUESTION
We use a Fifo Queue configured with a Lambda Function as a processor. We use MessageGoupId and BatchSize to optimistically remove redundant messages. To rate limit processing we use reserved concurrency. Our function timeout has to be high. The queue maximum receives is set to ten.
ObservedWhen there are a lot of messages in the queue, the Lambda function scales up. Once it scales enough to throttle, the queue processing comes to a complete hold and no further messages are processed until some minutes have passed.
I’m assuming this is because of throttling, because halting always coincides with throttling and when increasing the reserved concurrency, it takes much longer for the processing to come to a halt.
I’m assuming the time until the queue starts up again has to do with the lambda retry limit, the function timeout and the queue visibility timeout. But since I don’t know exactly what happens this is a guess.
IssueThere are no errors logged and ultimately all messages are processed, but since processing is time and throughput sensitive, it is not acceptable to have the queue halt for many minutes.
QuestionsWhat is happening and how can we solve this? If more information is needed I’d be very happy to debug further.
Edit: Found this: To allow your function time to process each batch of records, set the source queue's visibility timeout to at least 6 times the timeout that you configure on your function. The extra time allows for Lambda to retry if your function execution is throttled while your function is processing a previous batch.
and we are certainly in violation, but I'm not sure how / if this explains the observed behaviour.
ANSWER
Answered 2021-Jan-13 at 23:47At the end of this answer there is a complete, minimal example that is written to easily reproduce the issue.
To deploy, create all files and fill in your aws profile
and desired region
into all sh
files.
Then run
. deploy-stack.sh
to create the cloudformation stack that contains all necessary resources.
Then open the AWS web interface (SQS) and run
. generate-messages.sh
to generate messages on the queue.
One can then see that about half of the messages are processed before the function throttles and the queue comes to a complete halt.
To remove the cloudformation stack after all debugging has been completed run remove-stack.sh
AWS documentation contains a note saying
To allow your function time to process each batch of records, set the source queue's visibility timeout to at least 6 times the timeout that you configure on your function. The extra time allows for Lambda to retry if your function execution is throttled while your function is processing a previous batch.
Changing the timeout
on the lambda function from 600
to 100
and redeploying the stack allows all messages to process correctly even though the lambda function throttles.
I can not explain why this behaviour is observed and would greatly appreciate feedback on that. However the above does solve the issue described.
Filesstack.yaml
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install aws-lambda-sqs
You can use aws-lambda-sqs like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the aws-lambda-sqs component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page