Skip to content
Blog

The Promise of the Edge

Running code on globally distributed servers, close to each user. Millisecond latencies instead of hundreds of milliseconds. Sounds ideal.

Development2 min read
AlejandroChief Technology Officer

The Promise of the Edge

Running code on globally distributed servers, close to each user. Millisecond latencies instead of hundreds of milliseconds. Sounds ideal.

Cloudflare Workers, Vercel Edge Functions, Deno Deploy, AWS Lambda@Edge. There are many options and adoption is growing.

What Works Well at the Edge

Response transformations: modifying headers, redirecting, personalizing content based on geolocation. Fast operations that don't depend on external data.

Token authentication: verifying a JWT doesn't require querying a database. It can be done at the edge and reject invalid requests before they reach your server.

Smart caching: deciding what to cache and what not to, selectively purging, serving stale-while-revalidate.

A/B testing: deciding which variant to show without a roundtrip to the origin server.

What Doesn't Work Well at the Edge

Anything that requires querying a traditional database. If your edge code has to call a centralized server, you've added a layer without eliminating origin latency.

Operations that need shared state. The edge is inherently distributed. Maintaining consistency between nodes is complex.

Complex business logic. Edge platforms have limitations on runtime, memory, and available APIs.

The Common Antipattern

Moving your entire API to the edge because "it's faster." If every edge request makes a fetch to your database in us-east-1, you've added complexity without benefit.

The edge works when it reduces roundtrips, not when it adds them.

Databases at the Edge

Options are emerging: Turso, PlanetScale with read replicas, Cloudflare D1. They allow having data close to the edge.

But they add operational complexity. Global replication has consistency tradeoffs. Not every application needs them.

When to Evaluate Edge

Your audience is globally distributed and latency is critical.

You have operations that can complete without depending on a centralized origin.

The volume of traffic justifies the additional complexity.

When to Avoid It

Your audience is geographically concentrated. A server in Madrid serves Spain well.

Every operation needs to query your main database.

The team has no experience with distributed systems. Operational complexity has costs.

The edge is not the universal solution that marketing suggests. It's a specific tool for specific problems. Using it well requires understanding those problems.

Keep reading

Related articles

Development

The Code Slowing Down Your Website Isn't the One You Wrote

Third-party scripts are, on most of the websites we audit, the biggest source of slowness. Not the framework, not the images, not the server: the code you load from other domains. Analytics, support chat, advertising ...

Development

The Language That Machines Actually Understand

Structured data is the most direct way to explain to a machine what your page contains. A human reads “Different Growth, web development agency, rated 4.9 out of 5” and understands it instantly. A search engine, howev...

Next step

Do you have a project in mind?

If this article was useful and you want to know how we can help, we are here to listen.