SAP-C02 Practice Question 74: Lambda Java Cold Start SnapStart
AWS Certified Solutions Architect – Professional (SAP-C02) · Test 8 · question 4 of 10
A Java 21 function on AWS Lambda backs a customer-facing API. Traffic is spiky, and each cold start takes about 6 seconds because of framework initialization, which is too slow for the API's response-time goal of about 1 second at the 99th percentile. Product owners do not need double-digit-millisecond starts. The company wants to fix the problem with minimal code changes and does not want to pay for capacity that sits idle between spikes.
Which solution meets these requirements MOST cost-effectively?
Show answer and explanation
Answer:
Lambda SnapStart *"can provide as low as sub-second startup performance, typically with no changes to your function code."* Lambda initializes the function when you publish a version, snapshots the initialized execution environment, and *"resumes new execution environments from the cached snapshot instead of initializing them from scratch."* It works only on published versions and aliases, and for Java managed runtimes *"there's no additional cost for SnapStart"* beyond normal requests and duration. AWS advises testing code that depends on uniqueness of state, and validating network connections that were opened during initialization (option C).
- A is wrong because provisioned concurrency keeps environments initialized and responds in double-digit milliseconds, but it is billed for the whole time it is configured. AWS recommends it for strict cold start requirements that SnapStart cannot meet, which is not the case here. - B is wrong because more memory speeds up CPU-bound work, but a 6-second framework initialization would not fall to the goal, and the higher memory is billed on every invocation. - D is wrong because a rewrite is the opposite of minimal code changes, and Node.js would not necessarily start faster once the application framework is included.
Reference: Improving startup performance with Lambda SnapStart