Question

Difficulty: MediumServerless Development with AWS Lambda

A serverless application contains multiple AWS Lambda functions. During peak traffic periods, a background data-processing function triggered by Amazon S3 events scales rapidly and consumes all of the available execution concurrency in the AWS Region. This causes customer-facing Lambda functions integrated with Amazon API Gateway to fail with throttling errors. Which configuration should a developer apply to prevent the background function from exhausting the available regional concurrency?

  1. A
    Enable provisioned concurrency on the customer-facing API Gateway-triggered Lambda functions.
  2. B
    Configure an Amazon SQS queue between S3 and the background function, and set the queue's visibility timeout to zero.
  3. Configure a reserved concurrency limit on the background data-processing Lambda function.Answer
  4. D
    Attach a resource-based policy to the S3 bucket that limits the invocation rate of the background Lambda function.

Answer

Configure a reserved concurrency limit on the background data-processing Lambda function.
The correct answer is to configure a reserved concurrency limit on the background data-processing Lambda function. Setting a reserved concurrency limit on a Lambda function acts as a maximum concurrency cap (preventing it from scaling beyond that number and exhausting the region's shared unreserved pool) and also guarantees that the specified concurrency is dedicated to that function.

Step-by-Step Solution

1
Analyze the cause of the throttling error.
The background data-processing Lambda function is scaling excessively and consuming all regional unreserved concurrency, leaving no execution capacity for other functions.
AWS Lambda pools concurrency region-wide by default, meaning a high-scale function can starve other functions of execution slots.
2
Evaluate options for limiting concurrency consumption of a specific function.
Reserved concurrency allows developers to define a hard limit on the concurrency of a specific Lambda function.
By setting a reserved concurrency limit, the function cannot scale past that limit, thereby protecting the shared unreserved concurrency pool.
3
Differentiate reserved concurrency from provisioned concurrency.
Reserved concurrency acts as a ceiling to limit scale-out, whereas provisioned concurrency keeps environments warm and ready for expected load but does not cap execution growth.
Choosing reserved concurrency directly solves the problem of background function over-scaling.

Key Concept

Managing concurrency in AWS Lambda to prevent account-level resource starvation.
Rate this question