Skip to content
All articles
Cloud#Edge Computing#Serverless#Performance

Edge-first architecture: running code close to your users

The edge used to mean a CDN for images. Now it runs auth, personalisation, APIs and even small AI models a few milliseconds from the user.

EEPI TeamOct 9, 2026 · 6 min read
Edge-first architecture: running code close to your users

Light takes time to cross the planet. A request from Kerala to a server in the United States and back adds a couple of hundred milliseconds before any code runs. Multiply that by the dozen requests a page makes and the site feels slow, however well it is written.

Edge computing moves some of that code into data centres close to the user.

What runs at the edge now

Modern hosting platforms let you deploy functions that run in dozens or hundreds of locations at once. Typical jobs:

  • Routing and redirects, including country or language based ones.
  • Auth checks on a session cookie before a request reaches the origin.
  • Personalisation, such as currency, region-specific pricing or a returning-visitor banner.
  • A/B tests decided before the page is rendered, so there is no flicker.
  • API caching, serving popular responses from nearby with short expiry.
  • Small AI tasks, like moderation or classification, on platforms that offer inference at the edge.

The database trap

The most common mistake is moving a function to the edge while its database stays in one region. The function now starts 5 ms from the user, then makes three queries to a database 200 ms away, and the page is slower than before.

Edge compute only helps if the data it needs is close too. Options include:

  • Read replicas in the regions where your users are.
  • Edge key-value stores for config, feature flags and session data.
  • Caching query results at the edge with sensible expiry.
  • Keeping the write path regional, and accepting that writes take a little longer.

What should not move

Long-running jobs, heavy computation, large file processing and anything needing a persistent connection to a database are better in a regional backend. Edge runtimes often have limits on execution time, memory and available libraries.

A sensible split

For most products we land on three layers:

  1. Static assets and pages on a CDN, pre-rendered or cached where possible.
  2. Edge functions for routing, auth, personalisation and caching.
  3. A regional API and database for business logic and writes, placed near most of your users.

For an Indian business serving the Gulf too, that often means a backend in Mumbai or Singapore with edge caching everywhere, rather than a single US region by default.

Measure first

Use real-user monitoring to see where your users are and where time is going. If most of your traffic is in one country, a well-placed regional server may get you 90% of the benefit with none of the complexity.

#Edge Computing#Serverless#Performance#Cloud

Frequently asked questions

What is edge computing?

Running application code in many data centres close to users instead of one central server, so each request travels a shorter distance and responds faster.

Should my whole backend run at the edge?

Usually not. Fast, stateless tasks like routing, auth checks and caching suit the edge. Business logic that writes to a database usually belongs in a regional backend near your users.

Which region should an Indian business host in?

If most users are in India and the Gulf, a Mumbai or Singapore region with a CDN and edge caching is usually a better default than a US region.

Keep exploring

Newsletter

Enjoyed this? Get the next one first.

One email a month with our newest articles on AI, engineering, mobile, ERP and the products we ship. No spam, unsubscribe any time.

  • Monthly, never more
  • New case studies first
  • Practical, no hype

One email a month. No spam, unsubscribe any time.