What are Edge Computing & Serverless Edge Functions?

Last updated: July 2026

Edge computing is a model that runs compute near users or data sources; edge functions are serverless code executing at CDN locations. The broad term — canonically defined by Shi et al. as computation placed close to the sources of data — spans factory-floor IoT and telecom MEC infrastructure. For backend developers it means something specific: small functions deployed to the same global points of presence a CDN uses, running at whichever POP is nearest each request — the CDN’s evolution from caching content to executing code.

Key takeaways

QuestionAnswer
Why edge is fastPhysics — RTT is distance; a nearby POP is ~5 ms, an ocean is ~150 ms
The runtime trickV8 isolates: browser-tab sandboxes, ~ms startup, no container boot
What belongs thereStateless gateway logic — auth checks, redirects, personalization
What doesn’tData work — the database is still in one place
The honest caveatEdge moves the round trip; only data strategy removes it

An edge function, and the layer it lives in

// JavaScript — an edge function (web-standard APIs, runs at every POP)
// Gateway logic at the edge; the backend stays the source of truth
export default async function handler(request) {
  const url = new URL(request.url);
  const country = request.headers.get('x-user-country') ?? 'US';

  if (url.pathname === '/' && country !== 'US') {
    return Response.redirect(`${url.origin}/${country.toLowerCase()}/`, 302);
  }
  // Verify a session quickly at the edge; data work goes to the origin
  const auth = request.headers.get('Authorization');
  if (!auth) return new Response('Unauthorized', { status: 401 });

  return fetch(request); // pass through to the origin backend
}

The JavaScript tab is the edge function itself — web-standard Request/Response, no framework, intercepting traffic before the origin. The client tabs show the other side of the architecture: application data still flows to the origin backend, because that’s where the database lives — the sentence this entire article keeps returning to.

Isolates vs. containers: why edge starts in milliseconds

V8 isolates (edge)Containers / micro-VMs (regional FaaS)
Startupunder 5 ms — create a JS context100–1,000 ms — boot runtime, cold start
Memory per tenant~2 MB30–50 MB+
Isolation boundaryIn-process sandbox (browser-tab tech)OS/hypervisor — stronger
API surfaceWeb-standard subsetFull language runtime
Execution capsCPU-tens-of-ms, small bundlesMinutes, gigabytes
FitsPer-request gateway logicReal application workloads

Thousands of isolates share one long-running process per machine — the same mechanism that keeps browser tabs apart — so “starting” a function means creating a context, not booting a runtime. That architecture, not warm pools, is why edge platforms honestly claim near-zero cold starts. The bill is the third and fourth rows: a weaker isolation boundary (patched with careful mitigations) and a runtime where much of npm doesn’t run — no filesystem, no native modules, no dynamic evaluation, with the portable surface now being standardized as the Minimum Common API.

Edge vs. origin: the workload split

WorkloadRuns atWhy
Token/session checks, bot blockingEdgeReject bad traffic before it crosses an ocean
Redirects, geo-routing, A/B bucketingEdgePer-request, stateless, latency-visible
Header/cookie rewrites, cache logicEdgeThe CDN’s native habitat
Database reads and writesOriginThe data is there; RTT per query otherwise
Business logic, transactionsOriginStateful, multi-step, needs the full runtime
Media processing, long tasksOriginCPU caps forbid it at the edge

The honest part: your database is still in one place

The section vendor explainers omit. Moving compute to the edge does not move the data — it relocates the round trip from user → server to function → database, and for chatty workloads that’s a downgrade: an edge function 5 ms from the user making five sequential queries to a database 150 ms away spends 750 ms where a regional function co-located with the database would spend ~5. The arithmetic explains the industry’s quiet correction — some major edge platforms now recommend their regional runtimes for most workloads and added options to pin functions near the database, the strongest possible admission that data locality beats compute locality. The partial fixes, in order of practicality: run data-heavy code at the origin (the split table above); batch to one round trip when edge code must touch data; and replicate reads outward via edge key-value caches — eventual-consistency trade-offs included. Edge functions win when they complete at the edge; the moment they phone home per request, geography stops being on your side.

Edge functions in front of a central origin and databaseUsers connect to their nearest point of presence, where edge functions handle gateway logic like redirects and auth checks in milliseconds. Requests needing data continue to the central origin backend and database, paying the geographic round trip once, while static assets are served from the CDN cache at the same points of presence.

data work: one
round trip, batched

static: served
from cache

User (Tokyo)

Nearest POP
edge fn: auth, redirect ~5 ms

User (Berlin)

Nearest POP
edge fn + CDN cache

Origin backend
+ database (one region)

Users connect to their nearest point of presence, where edge functions handle gateway logic like redirects and auth checks in milliseconds. Requests needing data continue to the central origin backend and database, paying the geographic round trip once, while static assets are served from the CDN cache at the same points of presence.

When edge is over-engineering

Most applications are a CRUD backend with a regional user base — for them, a single-region backend plus a CDN for static assets is simpler and often faster end-to-end than an edge tier that round-trips to the same database. Edge functions earn their place when the logic completes at the edge for a globally distributed audience on a latency-visible path — three conditions, all required. The cost model tells the same story from the other side: edge platforms bill per-request plus CPU-milliseconds (cheap for thin gateway logic), while regional functions bill wall-clock duration — including the time your code spends waiting on the database it should have been sitting next to.

Common use cases

  • Authentication gates — verify a session token at the POP; unauthenticated requests never cross the ocean.
  • Geo-personalization — language, currency, and compliance routing decided milliseconds from the user.
  • A/B and feature bucketing — cookie assignment at the edge, consistent before the page even loads.
  • Rate limiting and bot defense — absorb abuse at the perimeter, per-POP counters in edge KV.
  • Broad edge computing — the IoT/telecom sense: factory sensors and 5G infrastructure processing locally, a different article’s depth acknowledged in one line.

Should you use edge functions? A decision matrix

SituationLean
Global users, latency-visible gateway logicEdge — its home game
Logic that completes at the edge (no DB)Edge
Chatty database access per requestOrigin — every time
Regional user base, standard CRUD appOrigin + CDN; edge adds nothing
Heavy dependencies, native modules, long CPUOrigin — the runtime forbids edge
Static assetsThe CDN cache — no function needed

Limitations and trade-offs

  • The runtime is a subset. Web-standard APIs only; ORMs with native bindings, image libraries, and filesystem-dependent code don’t run — check the dependency tree before committing.
  • CPU caps are strict. Tens of milliseconds of compute is the budget; edge functions shape traffic, they don’t process it.
  • State is elsewhere by design. Every stateful need routes to the origin or an edge KV with eventual-consistency semantics — neither is free.
  • Debugging is distributed. Reproducing a bug that only occurs at one POP under one geography is its own discipline; logging centrally from everywhere is the mitigation.
  • The pendulum swings. Edge-first defaults have already been walked back once; treat edge as a precise tool for gateway logic, not an architecture identity.

Edge and Back4app

Back4app is an open-source Backend-as-a-Service (BaaS) platform that combines a managed database, auto-generated REST and GraphQL APIs, authentication, file storage, and Cloud Code serverless functions. In the three-layer picture this article draws, Back4app is the origin done well: the database and Cloud Code business logic live together — the co-location that makes data work fast — behind a CDN that serves files and static assets from the same POPs an edge tier would use. Edge functions then slot in front as thin gateway logic where the three conditions hold: a redirect here, a token check there, passing through to an origin that owns the data and enforces ACLs on every request. The architecture lesson the honest section teaches — compute near the user, data work near the data — is exactly this split, with each layer doing the part geography favors.

Frequently asked questions

What is edge computing in simple terms?

Running computation close to where data is created or where users are, instead of in one distant data center. Less distance means fewer milliseconds and less bandwidth — the whole idea is geography. The term spans IoT sensors, telecom infrastructure, and, for web developers, code running at CDN locations.

What is an edge function?

A small serverless function deployed to a CDN's global points of presence and executed at whichever location is closest to each request — typically intercepting HTTP traffic to redirect, personalize, or authenticate before it reaches the origin backend.

What is the difference between edge functions and serverless functions?

Both are functions-as-a-service; they differ in where (hundreds of locations vs. one region), runtime (lightweight isolates with web-standard APIs vs. full containerized runtimes), cold starts (near zero vs. hundreds of milliseconds), and limits (tight CPU and size caps vs. minutes and gigabytes).

Why is the edge faster?

Physics. Round-trip time is bounded by distance through fiber — a cross-ocean round trip costs 100–300 ms before any computation happens, while a point of presence twenty kilometers away costs single digits. Isolate runtimes add near-zero startup on top.

What are V8 isolates?

Lightweight sandboxed JavaScript contexts — the same mechanism that separates browser tabs — running by the thousands inside one long-lived process. Each gets its own heap and globals, starts in under five milliseconds with megabytes of overhead, and needs no container or VM boot: the reason edge platforms report effectively zero cold starts.

What are the limitations of edge runtimes?

A web-standard API subset — fetch, Request/Response, streams, WebCrypto — with no filesystem, no native modules, and no dynamic code evaluation; tight CPU-time caps (tens of milliseconds is common) and small bundle limits. Many popular packages, from ORMs with native bindings to image libraries, simply don't run there.

What belongs at the edge, and what belongs at the origin?

Edge: stateless gateway logic near the user — token checks, redirects, geo-routing, A/B bucketing, header rewrites, rate limiting. Origin: everything stateful and transactional — database reads and writes, business logic, heavy processing. The rule of thumb: compute near the user, data work near the data.

Does my database ruin edge latency?

Often, yes — moving compute to the edge doesn't move the data. An edge function in Tokyo querying a database in Virginia pays a full trans-Pacific round trip per query; five sequential queries turn a five-millisecond function into a 750-millisecond one. Fixes: run near the data, batch to one round trip, or cache reads at the edge.

Is a CDN the same as edge computing?

A CDN caches and serves static content at points of presence; edge computing runs your code at those same locations. Edge functions are the programmable evolution of the CDN — same geography, active logic instead of passive caching.

Do edge functions have cold starts?

Effectively no on isolate-based platforms — context creation costs single-digit milliseconds, imperceptible next to network time. That is their headline advantage over container-based serverless, bought at the price of the restricted runtime.

Related terms

Compare with

Further reading

Ready to build your backend?

Start your project on Back4app in minutes — database, auth, APIs, and Cloud Code included. No credit card required.

Written and reviewed by Back4app Engineering, Back4app Engineering · Published 2026-07-30