The Edge Computing Playbook — What to Run at the Edge (and What Not To)
The edge is fast because it's constrained. This is the decision map for what belongs at the edge, what belongs at origin, and how compute, data, caching, and auth fit together.
Key takeaways
- The edge is fast because it's constrained.
- This is the decision map for what belongs at the edge, what belongs at origin, and how compute, data, caching, and auth fit together.
On this page
The Edge Computing Playbook — What to Run at the Edge (and What Not To)
The edge is fast for one reason: your code runs in a data center a few milliseconds from the user instead of one a few hundred milliseconds away. That speed comes with constraints. Small CPU budgets, no long-lived connections, limited runtimes, and data that lives somewhere else. Getting value from the edge is mostly about knowing which work fits inside those constraints and which work should stay at origin.
This is the map. It ties together the moving parts (compute, data, caching, auth, observability) and points to the deep dive for each. Use it to decide where each piece of a request should run.
What the edge is good at#
Edge functions shine at short, stateless, per-request work that benefits from being close to the user:
- Routing and rewrites: A/B tests, feature flags, geo-based redirects, request normalization. This is the sweet spot for Vercel edge middleware.
- Auth checks: validating a signed token before a request ever reaches origin, covered in edge auth without origin round-trips.
- Caching and cache logic: deciding what to serve from cache, with patterns like stale-while-revalidate and disciplined cache invalidation.
- Personalization at the CDN: small transforms on cached HTML per user or region.
- Streaming responses: starting to send HTML while the rest is still assembling, via streaming SSR at the edge.
What the edge is bad at#
The same constraints that make it fast make some work a poor fit:
- Heavy compute: edge runtimes cap CPU time per request (often tens of milliseconds). Image processing, large crypto, or big data transforms belong at origin. The exact ceilings are covered in edge runtime limits.
- Anything needing a full Node runtime: many npm packages assume Node APIs the edge doesn't have.
- Chatty database access: a function 5ms from the user but 120ms from your database is slower than one that runs next to the database. This is the single most common edge mistake.
The data problem is the whole game#
Compute at the edge is easy; data at the edge is the hard part. If your edge function has to reach back to a single-region primary database, you've moved the compute closer to the user but left the slow part where it was. The answer is to move data outward too:
- Edge databases replicate reads to the PoPs. See edge databases for low-latency apps and the Turso vs Cloudflare D1 comparison.
- Edge object storage like Cloudflare R2 vs S3 keeps assets close and egress cheap.
- Stateful coordination: when you need a single authoritative place to serialize writes (counters, rooms, locks), Durable Objects give you one addressable instance instead of a race across PoPs.
The rule: read-heavy, latency-sensitive data wants to be replicated to the edge; write-heavy or strongly-consistent data wants a single home, with the edge reaching it only when it must.
How requests actually reach the edge#
Before any of this runs, the network has to route the user to the nearest point of presence. That's anycast plus smart placement, explained in anycast and geo-routing. It's worth understanding because "the edge" isn't automatically the closest edge. Placement and routing decisions matter, especially for the data tier.
Platform choice#
The two dominant platforms make different trade-offs. The head-to-head that started this cluster, Cloudflare Workers vs Vercel Edge, covers latency and cost; the newer Workers vs Lambda@Edge comparison covers the AWS angle. For classic serverless where cold starts dominate, see serverless cold starts and CloudFront + Lambda@Edge.
Don't forget observability#
Edge functions run in hundreds of locations, which makes debugging harder, not easier. You need logs, traces, and metrics that aggregate across PoPs, covered in observability for edge functions. Skipping this is how teams end up with a fast site they can't troubleshoot.
The call we'd make#
Push the request-shaping work (routing, auth, caching, personalization, streaming) to the edge, and keep heavy compute and authoritative writes at origin. Then solve the data tier deliberately: replicate reads outward, keep strong-consistency writes in one place, and reach for Durable Objects only when you need coordination. Start with one thing, auth or caching, measure the latency win, and expand from there. Each linked guide is a concrete next step; the constraints are the feature, not the bug.
Stay Updated
Get the latest tutorials, guides, and insights on AI, DevOps, Cloud, and Infrastructure delivered directly to your inbox.
OIDC Federation Beyond GitHub — GitLab, Buildkite, and Generic Providers
GitHub Actions OIDC gets all the attention, but GitLab, Buildkite, and CircleCI issue the same signed tokens. Here's how to trust them without opening a hole.
Best LLM Observability Tools in 2026 — Langfuse, Helicone, Arize
A practitioner's guide to tracing, cost tracking, and evaluating LLM apps in production with Langfuse, Helicone, Arize Phoenix, and LangSmith.
More from Cloud
Explore more articles in this category
Best Serverless Databases in 2026 (Compared)
A practitioner comparison of the leading serverless databases by use case, cold-start behavior, branching, pricing model, and lock-in.
Cloudflare D1: The Edge SQLite Database Guide (2026)
A practitioner's look at Cloudflare D1, the serverless SQLite database built for Workers, covering setup, read replication, limits, and fit.
Neon vs PlanetScale: Serverless SQL Compared (2026)
A practitioner comparison of Neon's serverless Postgres against PlanetScale's Vitess-backed MySQL to help you pick the right database.
You might have missed
Evergreen posts worth revisiting.