Vercel serves Next.js applications from edge functions running in 30+ regions. A user in Mumbai gets their personalized page from a function running in Mumbai - not from a US-East server. The response time is often under 10ms, which feels instant. The function runs AT the CDN node, eliminating the round trip to a central origin entirely.
What Edge Functions Can Do
Edge Function Use Cases:
Use Case Without Edge With Edge
-------------------- ------------------ ------------------
A/B testing Origin decides Edge rewrites URL
(200ms+ round trip) (5ms, no origin)
Auth verification Origin validates Edge verifies JWT
JWT (200ms+) (5ms, blocks bad)
Geo-routing Client-side detect Edge reads IP geo
(slow, inaccurate) (instant, accurate)
Image resize Pre-generate all Resize on-the-fly
sizes (storage cost) (compute at edge)
Bot detection Origin processes Edge challenges
bot traffic (waste) bots before origin
Localization Origin renders Edge substitutes
per-locale page content by header
V8 Isolates vs Containers
Cold Start Comparison:
Approach Cold Start Memory Isolation
-------------- ---------- -------- ----------------
Full container 100-500ms 128MB+ Process-level
(Lambda@Edge) (strong)
V8 Isolate < 1ms ~2MB V8 sandbox
(CF Workers) (Chrome tabs)
Why V8 Isolates are faster:
Container: boot OS -> load runtime -> load code -> run
V8 Isolate: load V8 -> run (same engine as Chrome)
At 100,000 req/s, cold starts matter enormously.
1ms cold start: imperceptible
500ms cold start: visible to users on first request
Trade-off: V8 Isolates have
- No file system access
- Limited CPU time (10-50ms)
- No native code/C extensions
- JavaScript/TypeScript/WASM only
When discussing latency optimization, say: 'For logic that does not need database access - like authentication, A/B testing, geo-routing, or bot detection - I would move it to edge functions running at CDN PoPs worldwide. This eliminates the origin round trip, giving sub-10ms response times globally. I would use Cloudflare Workers for their V8 isolate architecture which has sub-millisecond cold starts, compared to Lambda@Edge containers which can add 100ms+ on cold starts.'
<Architecture overview
/blockquote>
Key Takeaway
Edge functions execute code at CDN nodes globally, enabling sub-10ms response times for logic that previously required an origin round-trip. Use them for A/B testing, auth, routing, and personalization. Cloudflare Workers (V8 isolates) offer better cold start performance than Lambda@Edge.
No comments yet. Be the first to start the thread!
Related Articles
Enjoyed this content?
Your support keeps us creating free resources
We put a lot of hours into researching and writing these guides. If it helped you, consider buying us a coffee. Every bit goes toward keeping ScaleDojo's content free and growing.
$
One-time payment via Stripe. ScaleDojo account required.