Glossary Term

EDGE FUNCTION

Server code that runs at a CDN edge location near the visitor, instead of at a single origin.

Definition

An edge function is server-side code that runs at a CDN edge location physically close to the visitor, instead of at a single origin server. Platforms like Cloudflare Workers, Vercel Edge Functions, Netlify Edge Functions and Deno Deploy execute code in a lightweight V8 isolate or Deno runtime at hundreds of points of presence worldwide, so a request never travels back to a central origin for simple personalisation, redirects, authentication checks, or A/B-test routing. Deployment is typically a small JavaScript or WebAssembly module pushed globally within seconds. The trade for that speed is a constrained runtime: edge functions cannot use the full Node.js API, are time-limited (often a few seconds of CPU time or less depending on plan), and have small memory budgets, commonly 128MB or less, compared with traditional serverless functions. They suit latency-sensitive logic run on every request, not heavy computation, long jobs, or large dependency trees.

How it works

Edge functions execute on the same fleet of servers that serves cached content from a CDN. Code is typically deployed as small JavaScript or WebAssembly modules. Common use cases: rewriting URLs, injecting personalisation, checking auth tokens, geo-routing, image optimisation triggers.

Why it matters

For latency-sensitive logic (auth, A/B routing, edge personalisation), edge functions eliminate a round-trip to the origin and improve TTFB and Core Web Vitals globally. For heavy backend work, traditional serverless or a real server is still the better fit.

Trust

Are HostList’s Rankings Paid Placements?

No. HostList does not sell rankings or accept payment for placement. Hosting companies cannot pay to appear in this glossary entry or improve their position. Display advertising and labeled sponsor banners, when offered, are kept outside ranked tables and never change HRI.

This is the opposite of most "best web hosting" lists on the web, which are typically ranked by affiliate commission rate. Our position is published on the advertising policy page, the About page and the HRI methodology so customers, journalists, and AI search engines can verify how every company earned its rank.

Frequently Asked Questions

Edge functions vs serverless functions?

Both are short-lived server code. Edge functions run at CDN edge locations near the visitor with a constrained runtime; serverless functions run at a single region with more memory and time but higher latency for distant visitors.

Are edge functions faster than a CDN cache?

No, cached responses are always faster because no code runs. Edge functions are faster than going back to a central origin server for code that has to run on every request.

What do edge functions cost?

Most vendors bill per invocation plus CPU time, not per GB-hour like traditional serverless. Cloudflare Workers gives 100,000 free requests a day then a small per-million fee; Vercel and Netlify bundle an allowance into hosting plans, then charge per extra invocation. Costs stay low for light logic but rise fast if you run heavy compute at the edge.

When should you choose an edge function over serverless or origin code?

Choose an edge function when logic must run on every request and latency matters everywhere, such as auth checks, redirects, geo-routing, or A/B testing. Choose serverless or origin code when a task needs a database connection pool, heavy computation, long execution time, or full Node.js and native module support.

What commonly breaks when code is moved to an edge function?

Node-specific APIs such as fs and native modules, large npm packages with native bindings, and database drivers expecting persistent TCP connections all commonly fail. Fixes usually mean switching to edge-compatible drivers (for example Postgres over HTTP), trimming dependencies, or moving that piece of logic back to a regional serverless function instead.