Serverless Language
5 exercises — master the vocabulary of serverless computing: cold starts, synchronous vs. asynchronous invocation, execution timeouts, stateless constraints, and concurrency management.
0 / 5 completed
Serverless vocabulary quick reference
- Cold start — latency of provisioning a new execution environment (runtime init + package download + init code)
- Warm invocation — reuses an existing environment; only the handler runs (much faster)
- Synchronous invocation — caller waits for function to complete; return value received (API Gateway, ALB)
- Asynchronous invocation — caller fires and forgets; Lambda manages retries + DLQ (S3, SNS, EventBridge)
- Execution timeout — maximum wall-clock duration per invocation (AWS Lambda: 15 minutes)
- Reserved concurrency — caps a function's max simultaneous executions AND reserves that capacity from the account pool
- Provisioned concurrency — pre-warms N environments to eliminate cold starts (costs more)
- DLQ (Dead Letter Queue) — receives events after all async retry attempts are exhausted
1 / 5
A developer observes: "The first request to this Lambda function after 15 minutes of inactivity takes 800ms; subsequent requests in the following minutes take 12ms."
What is the 800ms overhead called, and what causes it?
Cold start is the cost of spinning up a new execution environment from scratch — subsequent invocations reuse the warm environment and skip these steps.
What happens during a cold start:
Cold start mitigation strategies:
• Provisioned Concurrency (AWS) — pre-initialize a fixed number of execution environments; no cold start on invocation
• Keep-alive pings — schedule an EventBridge event every few minutes to keep environments warm (not reliable for production)
• Compiled languages — Go and Rust functions have near-zero cold starts vs. JVM cold starts of 2–6s with large frameworks
• Reduce package size — smaller deployment packages initialize faster; use tree-shaking to exclude unused dependencies
• Move heavy init outside handler — DB connections, loaded ML models, and SDK clients initialized at the module level persist across warm invocations
Key vocabulary:
• Cold start — the latency of initializing a new serverless execution environment when no warm instance is available
• Warm invocation — an invocation that reuses an already-initialized execution environment, skipping the cold start phases
• Provisioned Concurrency — a configuration that keeps a specified number of Lambda execution environments initialized and ready at all times
• Execution environment — the isolated runtime container (microVM in AWS Lambda's case) that hosts a function instance
What happens during a cold start:
| Phase | What occurs | Typical cost |
|---|---|---|
| Environment init | Cloud provider allocates a microVM / container for the execution environment | 50–200ms |
| Runtime start | JVM / Node.js / Python / .NET runtime initializes | 10–500ms (JVM worst case) |
| Deployment package download | ZIP or container image is fetched and extracted | Varies by package size |
| Init code execution | Code outside the handler runs: imports, DB connection setup, SDK initialization | Varies by application |
| Handler invocation | Your function handler runs | 12ms (warm: only this step) |
Cold start mitigation strategies:
• Provisioned Concurrency (AWS) — pre-initialize a fixed number of execution environments; no cold start on invocation
• Keep-alive pings — schedule an EventBridge event every few minutes to keep environments warm (not reliable for production)
• Compiled languages — Go and Rust functions have near-zero cold starts vs. JVM cold starts of 2–6s with large frameworks
• Reduce package size — smaller deployment packages initialize faster; use tree-shaking to exclude unused dependencies
• Move heavy init outside handler — DB connections, loaded ML models, and SDK clients initialized at the module level persist across warm invocations
Key vocabulary:
• Cold start — the latency of initializing a new serverless execution environment when no warm instance is available
• Warm invocation — an invocation that reuses an already-initialized execution environment, skipping the cold start phases
• Provisioned Concurrency — a configuration that keeps a specified number of Lambda execution environments initialized and ready at all times
• Execution environment — the isolated runtime container (microVM in AWS Lambda's case) that hosts a function instance