Skip to content

Lambda running just one instance

0

I have a Lambda function with reserved concurrency at 5. The function is running and in some cases it finds out in the middle that it needs to run another instance of itself and invokes the instance using the event-based InvokeRequest (it is in Java). The new instance, however, never starts immediately, it always waits for the current instance to finish and then it runs the next one. Why is that? How can I start another instance from inside of the current instance so that the instance starts immediately and both instances run in parallel?

asked 2 years ago329 views
2 Answers
1
Accepted Answer

Hi Tom,

The issue is likely due to the invocation type. Ensure you are using asynchronous invocation (InvocationType.Event) rather than synchronous (InvocationType.RequestResponse). Asynchronous invocation allows the new instance to start immediately and run in parallel.

Additionally, verify that your reserved concurrency of 5 is not being exceeded. Check CloudWatch logs for any throttling or errors and ensure the Lambda function has the necessary permissions to invoke itself.

Hope this helps.

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
EXPERT
reviewed 2 years ago
0

I am sorry, it works. The problem was in my locking code.

answered 2 years 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.