Edge Computing on CDN: Moving Logic to the Edge
Beyond Caching
Traditional CDNs cache and serve static content. Edge computing extends CDN PoPs into general-purpose computing platforms. Instead of just caching content, edge servers run your code — processing requests, transforming responses, and making decisions at the network edge, milliseconds from the user.
| Metric | Edge Processing | Origin Processing | Improvement |
|---|---|---|---|
| Latency (p50) | 8–15 ms | 120–300 ms | 15–20x faster |
| Cache Hit Ratio | 85–95% | N/A | Reduces origin load |
| TLS Handshake | 1–5 ms (nearby PoP) | 50–150 ms | 10–30x faster |
| Bandwidth Cost | $0.01–0.04/GB | $0.05–0.12/GB | 3–5x cheaper |
| Availability | 99.99% (multi-PoP) | 99.9% (single DC) | 10x fewer outages |
Why Compute at the Edge
Every request that must travel to a centralized origin adds latency. Edge compute eliminates that round-trip for logic that can run independently:
| Approach | Latency (TTFB) | Where Code Runs |
|---|---|---|
| Centralized origin | 100-500ms | One region (US-East, EU-West) |
| Multi-region deploy | 50-200ms | 3-6 regions |
| CDN edge compute | 5-50ms | 200-300+ PoPs globally |
Edge Compute Use Cases
- Request routing — Route requests to different origins based on URL, headers, cookies. See A/B testing at the edge.
- Authentication — Validate JWT tokens at the edge without hitting origin
- Personalization — Inject user-specific content into cached pages. See edge personalization.
- API gateway — Rate limiting, request transformation, response aggregation
- Image/video processing — Resize, format-convert, watermark at the edge. See image optimization.
- Geolocation — Country-specific content, geo-routing, compliance
Edge Compute Platforms
- Cloudflare Workers — V8 isolates, JavaScript/TypeScript/WASM. 200+ PoPs. Sub-millisecond cold start.
- Fastly Compute — WebAssembly-based. Any language that compiles to WASM. Sub-millisecond startup.
- AWS Lambda@Edge / CloudFront Functions — Lambda@Edge: Node.js/Python at regional edge. CloudFront Functions: lightweight JS at all PoPs.
- Akamai EdgeWorkers — JavaScript runtime at Akamai PoPs.
- Vercel Edge Functions — Built on Cloudflare Workers.
- Deno Deploy — Deno runtime at global edge locations.
See edge functions guide for detailed comparison.
Execution Model
Edge compute functions typically follow this model:
- Request arrives at edge PoP
- Edge runtime loads your function (from cache or cold start)
- Function executes with access to: request object, edge cache, KV store, external APIs
- Function returns a response or modifies the request before forwarding to origin
Cold start times vary: V8 isolates (Cloudflare): < 1ms. Containers (Lambda): 50-500ms. WASM (Fastly): < 1ms.
Constraints
Edge compute has limitations compared to traditional servers:
- CPU time limits — Typically 10-50ms of CPU time per request (not wall clock)
- Memory limits — 128 MB per request (Cloudflare Workers) to 256 MB+
- No persistent connections — No WebSocket server (some platforms support WebSocket proxy)
- Limited storage — Key-value stores (eventually consistent) instead of databases. See edge databases.