Summary
Add an optional warmer Lambda that periodically invokes the server Lambda to keep it warm, reducing cold start frequency.
Design
- Warmer Lambda — Scheduled via EventBridge (every 5 minutes)
- Sends a special "ping" event to the server Lambda
- Server Lambda detects ping and returns immediately without processing
- Configurable concurrency (warm N instances)
Configuration
serverless:
warmer:
enabled: true
interval: 5 # minutes
concurrency: 3 # keep 3 instances warm
Infrastructure to Auto-Provision
- Warmer Lambda function
- EventBridge scheduled rule
- IAM permissions for warmer to invoke server Lambda
Server Lambda Changes
Add ping detection at the top of the handler:
if (event.__NEXTDEPLOY_WARMER) {
return { statusCode: 200, body: "warm" };
}
Difficulty: Medium · Language: Go + JavaScript
Summary
Add an optional warmer Lambda that periodically invokes the server Lambda to keep it warm, reducing cold start frequency.
Design
Configuration
Infrastructure to Auto-Provision
Server Lambda Changes
Add ping detection at the top of the handler:
Difficulty: Medium · Language: Go + JavaScript