There is no way to reserve Lambda concurrency without reducing the unreserved concurrency, but the unreserved concurrency can be easily increased with a support request, which you can open directly from the Service Quotas page: https://us-east-1.console.aws.amazon.com/servicequotas/home/services/lambda/quotas/L-B99A9384
Answer from Shahar Mosek on Stack OverflowVideos
Anyone else having this issue? Every time I provision a new AWS account in our existing organization through Control Tower's Account Factory, the concurrent executions for Lambda is set to only 10, not the default 1000. I have to put in a quota increase request just to get the default 1000.
Applied quota value: 10
AWS default quota value: 1000
Is this an undocumented limit I've run into? We only have a dozen accounts. Is there a way to force this to 1000 in Account Factory?
I'm setting up my first Lambda function, and I'd really like to try out provisioned concurrency to avoid coldbooting. I really only need 1 concurrency at this time because I'm just testing and feeling it out.
But, in my provisioned concurrency screen it's telling me that i have 0 available. When I put the number 1 in the entry box, I get this error message in red.
The maximum allowed provisioned concurrency is 0, based on the unreserved concurrency available (10) minus the minimum unreserved account concurrency (10).
This is confusing to me, because every tutorial I've seen on youtube or read on a blog says that I should have 1000 available, not 10. I don't know how to increase this. Any ideas?
Thanks
Apart from that 1000 number of concurrent executions soft limit, there are other things to consider.
If you are using lambda functions to process events that are not poll based then the actual number of functions that you can run at a single moment is not 1000. The formula to calculate the number is
invocations per second * average execution duration in seconds
Which means that if your function takes 20 seconds on average to execute then the number of instances of that function that you can run simultaneously is 1000 / 20 which is equal to 50.
I am not saying that this is exactly the case with your code, but it is definitely something to consider when working with lambda limits.
If we are talking about poll based functions (Lambda integrated with Kinesis streams, DynamoDB streams) then another thing that comes into play is the number of shards in the stream. Each shard in the stream can be processes by at most 1 instance of a particular lambda function at a time (note that different lambda functions can process the same shard simultaneously). So if you have 50 shards in your stream then your lambda function can scale up to 50 instances of it, but the formula mentioned above still holds so if your function takes more than 20 seconds to process the message then the number of concurrent executions will be less than 50.
I think one of the reason why I got 50 instance log is the balance between latency time of last lambda function process and the time of next cold start. The configuration setting of Concurrency does not tell me it will cold start up 1000 unreserved account concurrency instantly. It do receive 1000 requests but once it will immediately free for next request, so there is no need to cold start another instance. But I am not sure whether it is true or not.
The other reason that I can confirm is the default limit of AWS.
"AWS Lambda has a default safety throttle of 100 concurrent executions per account per region. If you wish to submit a request to increase the throttle of 100 concurrent executions you can visit our Support Center..."
I did't not find the official doc but find the limit manually:
When I set concurrency to 100, then start two invoke scripts on local machine, each one of scripts send 500 invocation simultaneously. It will receive result log on a queue. The instances number on log will gradually increase to 100 instance, not 50 instance, which is the result by one invoke script.
But what if the concurrency is 100 but I start three invocation scripts? Will it startup 150 instances? No, it will throw out TooManyRequestsException error.
This test is not rigorous, still under investigating. Though not serious problem on producation, I really want to understand why this problem casued.
--UPDATE--
Q: Is there a limit to the number of AWS Lambda functions I can execute at once?
No. AWS Lambda is designed to run many instances of your functions in parallel. However, AWS Lambda has a default safety throttle of 100 concurrent executions per account per region. If you wish to submit a request to increase the throttle of 100 concurrent executions you can visit our Support Center, click “Open a new case”, and file a service limit increase request.
Q: What happens if my account exceeds the default throttle limit on concurrent executions?
On exceeding the throttle limit, AWS Lambda functions being invoked synchronously will return a throttling error (429 error code). Lambda functions being invoked asynchronously can absorb reasonable bursts of traffic for approximately 15-30 minutes, after which incoming events will be rejected as throttled. In case the Lambda function is being invoked in response to Amazon S3 events, events rejected by AWS Lambda may be retained and retried by S3 for 24 hours. Events from Amazon Kinesis streams and Amazon DynamoDB streams are retried until the Lambda function succeeds or the data expires. Amazon Kinesis and Amazon DynamoDB Streams retain data for 24 hours.
---UPDATE---
As it mentioned by me and Matus Dubrava, I managed my lambda function complexity to monitor the runtime of function. The metrics shows below:
Clearly we can see there is a relationship between Duration(300k Max) and ConcurrentExecutions(I set the max concurreny to 100).