Lambda Cold Start Latency
Serverless is great until your Lambda cold starts take 8 seconds.
The numbers:
- P50 latency: 50ms (great!)
- P95 latency: 200ms (fine)
- P99 latency: 8,000ms (terrible)
Why cold starts hurt:
- Java + Spring Boot Lambda
- VPC attached (adds 1-2 seconds)
- Large deployment package (250MB)
- Low traffic = frequent cold starts
- Every 10th user got 8-second wait
What we tried:
- ❌ Provisioned concurrency ($$$ for low traffic)
- ❌ Ping to keep warm (hacky, unreliable)
- ✅ Switch to Node.js (100ms cold start)
- ✅ Remove from VPC (wasn't needed)
- ✅ Reduce package size
After optimization:
- P99: 8,000ms → 400ms
- Happy users
Lesson: P99 matters more than P50. Know your cold start numbers before going serverless.