Edge Computing vs Traditional CDN: Cutting Latency with Cloudflare Workers
What edge computing adds beyond a CDN — running real logic at the edge with Cloudflare Workers and Lambda@Edge to cut latency, costs, and complexity.
A CDN moves your bytes closer to users. Edge computing moves your code closer to users. The difference between the two is where most of the latency, cost, and complexity in a modern stack quietly hides — and getting the edge computing vs CDN decision right is one of the highest-leverage infrastructure calls a team can make.
This piece is for engineers and technical leads weighing whether to push logic to the edge. We’ll cover what a CDN genuinely does well, what edge functions add on top, how Cloudflare Workers and Lambda@Edge differ under the hood, and where edge latency wins fall apart into anti-patterns. By the end you should know whether your next feature belongs at a point of presence (PoP) or in your origin region.
What a CDN actually does (and where it stops)
A traditional CDN is a caching layer. It replicates static assets — images, CSS, JavaScript bundles, fonts, video segments — across a global network of PoPs so a user in Sydney fetches from a nearby city instead of a server in Virginia. That’s a real win: fewer round-trips over long-haul links, lower origin load, and better tail latency on cold assets.
CDNs are also good at a fixed menu of request-time behaviors: gzip/brotli compression, basic header rewriting, redirect rules, TLS termination, and increasingly some WAF and bot-mitigation features. These are configured, not programmed. You declare a rule; the CDN enforces it.
Where the CDN stops is anything that requires decisions. A cache either has your object or it doesn’t. It can’t look at a logged-in user’s session and decide which variant of a page to serve. It can’t validate a JWT, call a downstream API, stitch responses together, or enforce per-tenant rate limits with custom logic. For all of that, the classic answer was “send the request back to origin” — which throws away the geographic advantage you were paying the CDN for in the first place.
What edge computing adds on top
Edge computing puts a programmable runtime at the same PoPs where your CDN already caches. Instead of routing dynamic requests back to a single region, you run real logic — JavaScript, TypeScript, WebAssembly — within milliseconds of the user. This is the heart of the edge computing vs CDN distinction: caching versus computation, both happening at the edge.
The workloads that map cleanly to edge functions:
- Authentication and authorization — verify a token, check a session, redirect unauthenticated users before the request ever touches origin.
- A/B testing and feature flags — assign a variant deterministically and rewrite the response, with no client-side flicker.
- Personalization — inject geo, language, or segment-specific content into otherwise cacheable HTML.
- API routing and gateways — fan requests out to the right backend, normalize versions, or merge multiple upstream calls.
- URL rewrites and redirects with logic — conditional routing that’s too dynamic for static rules.
- Rate limiting and abuse control — count and throttle per IP, per key, or per tenant at the edge, shedding bad traffic before it costs you origin capacity.
The common thread: each of these is a decision that used to require a round-trip to a central server, and each can now be made next to the user. That’s the design problem we focus on when clients ask us about edge compute — figuring out which decisions belong at the PoP and which should stay home.
The request lifecycle, and why the edge cuts latency
To understand why edge latency improvements are real and not marketing, follow a single dynamic request.
Without edge compute, a personalized page request from a user in São Paulo to an origin in us-east-1 looks like this: DNS resolution, a TLS handshake over a ~120ms round-trip, the HTTP request, origin processing, and the response coming back over the same long link. If the page needs three serial API calls before it can render, each adds another round-trip. Latency compounds, and the worst-affected requests — your p95 and p99 — get punished hardest because every retry and every slow hop stacks.
With edge compute, the TLS handshake terminates at the nearby PoP. The Worker runs the auth check, the variant assignment, and even some of the data fetching locally. Only the irreducible origin calls cross the ocean, and they can often be parallelized or served from edge-side storage. You’re not making the speed of light faster; you’re making fewer trips across it.
The biggest gains show up in tail latency. Median latency might improve modestly, but p95/p99 — the requests that drive bounce rates and timeout cascades — commonly drop substantially when you eliminate redundant origin round-trips. In our experience teams often see meaningful tail-latency reductions on auth- and personalization-heavy paths, though the exact figure depends entirely on geography and how chatty the original flow was.
Key takeaway: A CDN brings your content closer to users; edge computing brings your logic closer too — and the largest, most reliable wins are in tail latency on dynamic, decision-heavy requests, not in raw median speed.
Cloudflare Workers, Lambda@Edge, and Deno Deploy
The three platforms most teams evaluate take meaningfully different approaches.
Cloudflare Workers run on the V8 isolate model. Instead of spinning up a container or VM per function, Cloudflare runs many tenants’ code inside lightweight V8 isolates in a shared process. The payoff is near-zero cold starts — typically single-digit milliseconds or effectively none — and a huge PoP footprint. Workers pair with two storage primitives worth knowing:
- Workers KV — a globally replicated, eventually consistent key-value store. Great for config, feature flags, and read-heavy data that tolerates a short propagation delay.
- Durable Objects — single-instance, strongly consistent stateful objects. These unlock coordination at the edge: rate limiters, collaborative sessions, counters, and anything needing a single source of truth without a round-trip to a central database.
Lambda@Edge (and the lighter-weight CloudFront Functions) bring AWS’s compute model to CloudFront PoPs. Lambda@Edge runs full Node.js or Python in a container-backed model, so you get richer runtimes and tight integration with the rest of AWS — but with container-style cold starts and tighter limits on execution time and package size at edge tiers. CloudFront Functions are a more constrained, ultra-fast option for simple header and URL manipulation. If your team already lives in AWS, the operational gravity here is significant.
Deno Deploy also uses V8 isolates with a strong TypeScript-first, Web-standard API. It’s an attractive middle ground for teams who want isolate-style performance with a clean, standards-based developer experience.
Isolates vs containers: why cold starts matter
The architectural fork is isolates versus containers, and it’s the single biggest practical difference.
Containers (the Lambda@Edge model) give you a near-complete OS environment per function. That’s flexible, but starting one cold means provisioning and initializing a sandbox — tens to hundreds of milliseconds, sometimes more. Under spiky traffic, cold starts hit exactly when you can least afford them.
Isolates (the Workers and Deno Deploy model) share a process and start a new execution context in roughly a millisecond. The trade-off is constraint: you’re in a JavaScript/Wasm sandbox, not a general-purpose OS, so some native dependencies and long-running workloads don’t fit. For request-path edge logic, that constraint is usually a feature — it forces the kind of small, fast, stateless code the edge rewards.
Good use cases — and clear anti-patterns
Edge functions shine when work is small, latency-sensitive, and close to the request boundary. They struggle when work is heavy, stateful in complex ways, or data-gravity-bound.
Strong fits:
- Auth and token validation at the front door.
- Personalization and localization on cacheable shells.
- A/B testing and gradual rollouts without client flicker.
- API gateways, request coalescing, and response shaping.
- Edge-side rate limiting and bot mitigation.
- Image and asset transformation on the fly.
Anti-patterns to avoid:
- Heavy compute. Long-running jobs, large data processing, or anything CPU-bound for seconds belongs in a regional service, not on a per-request edge budget.
- Chatty database access from the edge. If your Worker makes several serial calls to a single-region database, you’ve reintroduced the round-trips you were trying to remove. Co-locate data (edge KV, Durable Objects, a globally distributed DB) or keep that logic at origin.
- Strong consistency across the globe by default. Eventual consistency is the edge’s natural state. Fighting it everywhere leads to fragile systems; reach for Durable Objects or a regional source of truth only where consistency is genuinely required.
- Giant bundles and native dependencies. Isolate runtimes have size and API limits. Code that assumes a full Node environment will not port cleanly.
The honest rule: if a request needs a fast decision near the user, push it to the edge. If it needs a lot of data or a lot of CPU that lives in one place, keep it near that place.
Cost and architecture trade-offs
Edge platforms typically price on requests and CPU time, often with generous free and low tiers. For request-path logic that runs in single-digit milliseconds, this is frequently cheaper than running equivalent always-on origin capacity, and you offload work that would otherwise scale your origin. Teams commonly see meaningful reductions in origin egress and compute load — often in the 30–70% range for traffic that was previously round-tripping unnecessarily — but treat that as a range to validate against your own traffic, not a guarantee.
The trade-offs that bite are operational, not just financial:
- Debugging and observability are harder across hundreds of PoPs than in a single region. Invest in structured logging and tracing early.
- State and consistency force real design decisions. Decide deliberately where your source of truth lives.
- Vendor coupling is real. Workers, Lambda@Edge, and Deno Deploy share Web-standard surfaces but diverge on storage and platform APIs; keep platform-specific code behind a thin boundary.
- Local development parity varies by platform. Pick tooling (Wrangler, the AWS toolchain, the Deno CLI) and standardize on it.
For teams already optimizing their broader cloud footprint, the edge conversation usually overlaps with MSP & cloud optimization — the same exercise of moving the right workload to the right place for cost and performance.
A pragmatic adoption path
You don’t migrate to the edge in one move. Start narrow and earn the next step.
- Pick one high-value, low-risk path. Geo-based redirects, security headers, or a single A/B test are ideal first Workers — clear wins, easy rollback.
- Move auth and routing to the front door. Validate tokens and route requests at the edge so origin only sees clean, authorized traffic.
- Introduce edge state carefully. Use KV for read-heavy config and feature flags; reach for Durable Objects only where you need coordination or strong consistency.
- Shape and personalize responses. Once auth and routing are stable, layer in personalization on cacheable shells to push more of the dynamic work outward.
- Measure tail latency and origin load at each step. Let p95/p99 and egress numbers — not enthusiasm — decide how far to go.
Done this way, each step is independently valuable, reversible, and measurable. The architecture that emerges is a thin, fast decision layer at the edge over a leaner origin — which is exactly what most “edge computing vs CDN” debates are really reaching for. This is the migration shape we tend to recommend when building or modernizing apps alongside our web development work, and it pairs naturally with deeper edge compute engagements.
Frequently asked questions
Is edge computing a replacement for a CDN?
No — it’s a complement. You still want the CDN’s caching for static assets; edge functions add programmable logic at the same PoPs. In practice most edge platforms ship both together, so you’re layering compute onto your existing caching network rather than swapping one for the other.
Do Cloudflare Workers really have no cold starts?
Effectively none for typical request-path code, because Workers use V8 isolates that start a new execution context in roughly a millisecond rather than booting a container. You can still introduce latency with heavy initialization in your own code or large dependencies, so keep Workers small and lazy-load what you can.
When should I choose Lambda@Edge over Cloudflare Workers?
Choose Lambda@Edge when you’re deeply invested in AWS and need its runtimes, IAM integration, and broader service ecosystem on the request path. Choose Cloudflare Workers (or Deno Deploy) when cold-start performance, PoP density, and a Web-standard, isolate-based model matter more than AWS-native integration. Many teams run both for different paths.
Edge computing isn’t about chasing the newest runtime — it’s about putting each decision in the right place so users get fast responses and your origin does less work. If you’re weighing where your logic should live or planning a move to Cloudflare Workers or Lambda@Edge, contact us and we’ll help you map the highest-leverage path first. The smallest correct edge change often pays for the whole effort.