📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

Your .NET Lambda function has a p99 cold start of two seconds. What would you measure first, and which changes would you try, in what order?

Intermediate Theory Intermediate

🎯 Key points

  • Measure Init Duration from REPORT logs or Lambda Insights first
  • Remove dependencies, lazy-initialise, cache secrets
  • More memory means more CPU during init
  • SnapStart restores an initialised snapshot; re-create unique state after restore
  • Warm-up pings keep only one environment warm, so they don't help on scale-out
  • Native AOT on provided.al2023 for the biggest gain
  • Provisioned concurrency only where latency justifies the cost

⏱ 30-second answer

First I measure: the Init Duration in the CloudWatch REPORT lines (or Lambda Insights), and a trace of the INIT phase to see where time goes: runtime start, assembly loading, DI, SDK clients, secrets fetched at start-up, and VPC networking if the function is attached to a VPC. Then I try the cheapest fixes first:

  1. Remove unused dependencies and lazy-load rarely used services.
  2. Move secret reads to a cached client.
  3. Raise memory, which gives more CPU during init.
  4. Switch to source-generated System.Text.Json.
  5. Try SnapStart.

Scheduled warm-up pings (an EventBridge rule every few minutes) keep only one environment warm, so they don't help when traffic scales out. If p99 still matters, I publish with Native AOT on provided.al2023, or pay for provisioned concurrency for the latency-critical function only. I re-measure after each change.

🔍 What the interviewer is checking

Checks whether they can measure and fix cold starts rather than just name them.

↩ Usually asked after

More in AWS

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me