Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I limit concurrent invocations of an AWS Lambda?

I have a Lambda function that’s triggered by a PUT to an S3 bucket.

I want to limit this Lambda function so that it’s only running one instance at a time – I don’t want two instances running concurrently.

I’ve had a look through the Lambda configuration and docs, but I can’t see anything obvious. I can about writing my own locking system, but it would be nice if this was already a solved problem.

How can I limit the number of concurrent invocations of a Lambda?

like image 371
alexwlchan Avatar asked Feb 03 '17 16:02

alexwlchan


People also ask

How many invocations can Lambda handle?

"Note: Lambda can support up to 1000 (combined total of processes and threads) concurrent executions by default." This isn't correct. Processes and threads are not a factor, here. 1000 concurrent invocations means 1000 containers. Each invocation is entirely independent of any others.

What happens when Lambda reaches concurrency limit?

When the burst concurrency limit is reached, the function starts to scale linearly. If this isn't enough concurrency to serve all requests, additional requests are throttled and should be retried. The function continues to scale until the account's concurrency limit for the function's Region is reached.

What is concurrent execution in Lambda?

In AWS Lambda, which is the core of the serverless platform at AWS, the unit of scale is a concurrent execution. This refers to the number of executions of your function code that are happening at any given time. Thinking about concurrent executions as a unit of scale is a fairly unique concept.

What are the limitations of AWS Lambda?

AWS Lambda has the following limitationsThe disk space (ephemeral) is limited to 512 MB. The default deployment package size is 50 MB. The memory range is from 128 to 3008 MB. The maximum execution timeout for a function is 15 minutes*.


1 Answers

AWS Lambda now supports concurrency limits on individual functions: https://aws.amazon.com/about-aws/whats-new/2017/11/set-concurrency-limits-on-individual-aws-lambda-functions/

enter image description here

like image 54
Robert Chen Avatar answered Oct 25 '22 10:10

Robert Chen