
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
A company hosts an internal serverless application on AWS by using Amazon API Gateway and AWS Lambda. The company's employees report issues with high latency when they begin using the application each day. The company wants to reduce latency.
Which solution will meet these requirements?
A
Increase the API Gateway throttling limit.
B
Set up a scheduled scaling to increase Lambda provisioned concurrency before employees begin to use the application each day.
C
Create an Amazon CloudWatch alarm to initiate a Lambda function as a target for the alarm at the beginning of each day.
D
Increase the Lambda function memory.
Explanation:
Correct Answer: B - Set up a scheduled scaling to increase Lambda provisioned concurrency before employees begin to use the application each day.
Why this is correct:
Cold Start Problem: The high latency issue at the beginning of each day is typically caused by Lambda cold starts. When Lambda functions haven't been invoked for a while (overnight), AWS may deallocate the execution environments, causing subsequent invocations to experience latency while new environments are initialized.
Provisioned Concurrency: This feature keeps Lambda functions initialized and ready to respond immediately to invocations. By setting up scheduled scaling to increase provisioned concurrency before employees start using the application, you ensure that the functions are already warmed up and ready to handle requests without cold start delays.
Predictable Usage Pattern: Since the issue occurs at the beginning of each day (predictable pattern), scheduled scaling is the most appropriate solution.
Why other options are incorrect:
A. Increase the API Gateway throttling limit: This addresses API Gateway request limits, not Lambda cold start latency. Throttling limits control the rate of requests, but don't affect the initialization time of Lambda functions.
C. Create an Amazon CloudWatch alarm to initiate a Lambda function as a target for the alarm: This doesn't solve the cold start problem. CloudWatch alarms are reactive monitoring tools, not proactive warm-up solutions.
D. Increase the Lambda function memory: While increasing memory can improve Lambda execution time (CPU scales with memory), it doesn't address cold start latency. Cold starts occur regardless of memory allocation, and increasing memory may even slightly increase cold start time due to larger initialization requirements.
Best Practice Recommendation: For predictable traffic patterns like daily business hours, use Lambda provisioned concurrency with scheduled scaling. For unpredictable traffic, consider using application auto-scaling based on metrics like concurrent executions or latency.