Edge Functions vs Serverless: A Performance Showdown
Everyone talks about "running at the edge," but how much faster is it really? I benchmarked cold starts, throughput, and latency across three platforms — Vercel Edge Functions, AWS Lambda, and Cloudflare Workers — with real-world payloads.
The Test Setup
I deployed the same API endpoint to all three platforms:
- Endpoint: JSON transformation — accepts a payload, validates with Zod, transforms, and returns
- Payload sizes: small (1KB), medium (50KB), large (500KB)
- Regions tested: US East, EU West, AP Southeast
- Tool: custom load testing script using
undicifor consistent HTTP/2 connections
Each platform was tested with 1,000 requests per configuration, measuring P50, P95, and P99 latencies.
Cold Start Results
Cold starts are the biggest differentiator:
| Platform | Cold Start (P50) | Cold Start (P99) | |----------|----------------:|----------------:| | Cloudflare Workers | 2ms | 8ms | | Vercel Edge Functions | 5ms | 15ms | | AWS Lambda (Node.js) | 180ms | 450ms |
Edge functions essentially have no cold start because they use V8 isolates instead of full containers. Lambda's cold start is significantly worse, especially with larger bundle sizes.
Warm Latency
Once warmed up, the gap narrows but edge still wins for global distribution:
- Same-region requests: All three platforms within 5ms of each other
- Cross-region requests: Edge functions served from the nearest PoP, reducing latency by 50-80ms compared to a single-region Lambda
Throughput Under Load
At 500 concurrent requests:
- Cloudflare Workers: handled gracefully, no degradation
- Vercel Edge Functions: slight P99 increase at high concurrency
- AWS Lambda: auto-scaled smoothly but with higher per-request cost
The Tradeoffs
Edge functions aren't universally better. Key limitations:
- No Node.js APIs — you're in a V8 isolate, not a full Node runtime
- Execution time limits — typically 30 seconds max (vs 15 minutes on Lambda)
- Memory limits — usually 128MB (vs up to 10GB on Lambda)
- No filesystem access — everything must be in-memory or fetched from external storage
- Limited npm compatibility — packages using Node built-ins won't work
When to Use What
Choose Edge Functions when:
- Low-latency responses matter (auth checks, redirects, A/B testing)
- Your logic is lightweight and doesn't need Node.js APIs
- Global distribution is important
Choose Lambda when:
- You need full Node.js runtime features
- Processing is CPU/memory intensive
- Execution might take more than 30 seconds
- You need VPC access for databases
Choose Cloudflare Workers when:
- You want the absolute lowest latency
- You're building middleware or API gateways
- You can work within the Workers runtime constraints
Conclusion
Edge functions are a genuine improvement for the right use cases, not just marketing hype. But they're a complement to traditional serverless, not a replacement. Choose based on your actual requirements, not the buzzword.
All benchmark code is available in my GitHub repo if you want to reproduce these results.