Traditional serverless runs in a few regions. Edge computing runs your code in hundreds of locations worldwide, executing within 50ms of any user. This site runs on Cloudflare Workers โ here is how edge computing works.
What is Edge Computing?
CDN edge servers cache static content close to users. Edge computing extends this by running custom code at those same locations. Your function executes in Singapore for Asian users, Frankfurt for Europeans, and so on.
Cloudflare Workers
Workers use V8 isolates (same engine as Chrome) instead of containers. This enables:
- Cold Start: <5ms โ No container spin-up. Isolates are lightweight.
- 300+ Locations โ Every Cloudflare data center runs Workers.
- Free Tier โ 100,000 requests/day at no cost.
- Workers KV โ Global key-value storage with eventual consistency.
- Durable Objects โ Strongly consistent storage with single-threaded access.
AWS Lambda@Edge
Lambda@Edge runs Node.js or Python at CloudFront edge locations:
- Viewer Request/Response: Runs at all 400+ CloudFront POPs.
- Origin Request/Response: Runs at regional edge caches (fewer locations).
- Cold Start: 50-200ms โ Container-based, slower than Workers.
- Timeout: 5-30 seconds โ Longer execution allowed than Workers (50ms CPU).
Fastly Compute
Fastly uses WebAssembly for edge execution, allowing any language that compiles to Wasm (Rust, Go, etc.). Startup time is similar to Workers.
When to Use Edge Computing
- A/B Testing: Route users to different origins without client-side JavaScript.
- Geolocation: Serve localized content, block regions, redirect by country.
- Authentication: Verify JWTs at the edge before hitting origin.
- API Gateway: Transform requests/responses, rate limit, cache API responses.
This entire site โ IP lookup, speed test, blog โ runs on Cloudflare Workers with zero origin servers.