Performance: Edge runtime vs Node.js runtime
HIGH IMPACT
This affects server response time and how fast the page starts rendering by choosing where and how code runs.
export const runtime = 'edge'; export async function GET() { // lightweight logic suitable for edge return new Response('Hello from Edge runtime'); }
export const runtime = 'nodejs'; export async function GET() { // heavy server logic return new Response('Hello from Node.js runtime'); }
| Pattern | Server Location | Network Latency | Response Time | Verdict |
|---|---|---|---|---|
| Node.js runtime | Central server | High for distant users | Slower due to centralized processing | [X] Bad for global users |
| Edge runtime | Distributed CDN nodes | Low due to proximity | Faster with reduced latency | [OK] Good for fast LCP |