SAA-C03 · Question #394
SAA-C03 Question #394: Real Exam Question with Answer & Explanation
The correct answer is D: Update the Lambda functions to add a pre-snapshot hook. Move the code that generates unique. AWS Lambda SnapStart is designed to improve the cold start performance of Java Lambda functions by initializing the function, taking a snapshot of the execution environment, and then reusing that snapshot for subsequent invocations. However, some code (such as code that generates
Question
A company is developing a latency-sensitive application. Part of the application includes several AWS Lambda functions that need to initialize as quickly as possible. The Lambda functions are written in Java and contain initialization code outside the handlers to load libraries, initialize classes, and generate unique IDs. Which solution will meet the startup performance requirement MOST cost-effectively?
Options
- AMove all the initialization code to the handlers for each Lambda function. Activate Lambda
- BPublish a version of each Lambda function. Create an alias for each Lambda function. Configure
- CPublish a version of each Lambda function. Set up a provisioned concurrency configuration for
- DUpdate the Lambda functions to add a pre-snapshot hook. Move the code that generates unique
Explanation
AWS Lambda SnapStart is designed to improve the cold start performance of Java Lambda functions by initializing the function, taking a snapshot of the execution environment, and then reusing that snapshot for subsequent invocations. However, some code (such as code that generates unique IDs or session-specific data) should run during each invocation, not during the snapshot process. By using a pre-snapshot hook and moving the unique ID generation into the handler, you ensure that non-deterministic or per-invocation code is executed correctly, while the rest of the initialization benefits from SnapStart. This delivers the lowest latency and cost, as you do not need to pay for provisioned concurrency.
Community Discussion
No community discussion yet for this question.