What is the maximum concurrency setting and how does it influence autoscaling?
By default, all AWS accounts start with a maximum concurrent execution limit of 1,000 for Lambda functions across all regions. This is the maximum number of functions that can be running simultaneously in your account. You can request a quota increase to support a higher concurrency limit.
The maximum concurrency setting for an individual Lambda function refers to the maximum number of executions that function can support at one time. You can configure this setting using reserved concurrency or provisioned concurrency:
- Reserved concurrency: This allows you to reserve a portion of your account’s concurrent execution limit for a specific function. For example, you may reserve 400 concurrent executions for a critical function, leaving 600 for other functions.
- Provisioned concurrency: This provisions a fixed number of pre-initialized execution environments for a function. It ensures that at least that number of executions will have minimal cold start latency.
Both reserved and provisioned concurrency count towards your account’s maximum concurrent execution limit.
This maximum concurrency setting affects how Lambda autoscales a function as follows:
- If a function does not have a maximum concurrency setting, it will scale up to utilize all available concurrency in your account. This could impact other functions.
- When a function hits its maximum concurrency setting, it will start throttling requests. This puts an upper limit on how much the function can scale.
In summary, the maximum concurrency setting for a Lambda function allows you to:
1) Reserve capacity for critical functions
2) Prevent functions from scaling out of control and impacting other functions or downstream services
3) Put an upper bound on the costs of a function by limiting its maximum scale