Reserved concurrency - AWS Lambda

Reserved concurrency

Lambda functions in a single AWS account in one Region share the concurrency limit. If one function exceeds the concurrent limit, this prevents other functions from being invoked by the Lambda service. You can set reserved concurrency for Lambda functions to ensure that they can be invoked even if the overall capacity has been exhausted. Reserved concurrency has two effects on a Lambda function:

  1. The reserved concurrency is deducted from the overall capacity for the AWS account in a given Region. The Lambda function always has the reserved concurrency available exclusively for its own invocations.

  2. The reserved concurrency restricts the maximum number of concurrent invocations for that function. Synchronous requests arriving in excess of the reserved concurrency limit will fail with a throttling error.

You can also use reserved concurrency to throttle the rate of requests processed by your workload. For Lambda functions that are invoked asynchronously or using an internal poller, such as for S3, SQS, or DynamoDB integrations, reserved concurrency limits how many requests are processed simultaneously. In this case, events are stored durably in internal queues until the Lambda function is available. This can help create a smoothing effect for handling spiky levels of traffic.

For example, a Lambda function receives messages from an SQS queue and writes to a DynamoDB table. It has a reserved concurrency of 10 with a batch size of 10 items. The SQS queue rapidly receives 1,000 messages. The Lambda function scales up to 10 concurrent instances, each processing 10 messages from the queue. While it takes longer to process the entire queue, this results in a consistent rate of write capacity units (WCUs) consumed by the DynamoDB table.


               application design figure 7

To learn more, read Managing AWS Lambda Function Concurrency and Managing concurrency for a Lambda function.