Platform SettingsMemory Config
Memory Configuration
Sometimes more memory = lower total cost.
TL;DR
Higher memory = more CPU = faster execution. Sometimes bumping memory from 512MB to 1024MB makes functions run 2x faster, cutting Active CPU time in half. Test both directions.
Memory affects cost in two ways:
- Direct: Higher memory = higher per-hour rate
- Indirect: Higher memory = more CPU = faster execution
Sometimes bumping memory lowers total cost.
The Math
Cost = (Provisioned Memory Rate × Time) + (Active CPU Rate × CPU Time)If higher memory cuts CPU time significantly, you win.
Execution: 800ms CPU time
Memory rate: $0.0053/hourExecution: 300ms CPU time (faster)
Memory rate: $0.016/hourIf Active CPU savings exceed the memory cost increase, higher memory wins.
Guidelines
| Workload | Memory |
|---|---|
| Auth checks, simple CRUD | 512 MB |
| Standard API routes | 1024 MB |
| Complex aggregations | 1536 MB |
| PDF/image generation | 2048+ MB |
Configure Per-Route
{
"functions": {
"app/api/health/**": { "memory": 512, "maxDuration": 5 },
"app/api/reports/**": { "memory": 2048, "maxDuration": 60 },
"app/api/**": { "memory": 1024, "maxDuration": 30 }
}
}Routes match from most specific to least specific.
With platform settings done, see Rendering Strategy for code-level wins.