Blog / How the internet works /

Edge computing explained

Distance matters on the internet. Data travels fast, but not instantly, and a visitor in Lagos asking a server in Virginia for a page has a long round trip ahead of them. Every request pays that delay.

Edge computing is the idea of cutting that trip short by doing the work nearer to the person asking.

The plain definition

“The edge” means locations at the edge of the network, close to users: hundreds of small data centres spread across cities around the world, rather than one big central one. Edge computing means running code, and sometimes keeping data, at those locations.

If that sounds like a CDN, you’re not far off, and that’s the best way in.

From CDN to edge

A CDN (content delivery network) stores copies of your static files, like images, stylesheets and scripts, in many places. When someone visits, the files come from a nearby location. I explained the basics in what is a CDN and do you need one.

Edge computing takes the next step: instead of only storing copies, those locations can run small programs. They can decide what to show, change a response on the fly, check a login, redirect a visitor or fetch some data, all without going back to your main server.

The analogy

Imagine a restaurant chain with one central kitchen. Meals are cooked there and driven to every branch. The food arrives late and cold for the faraway branches.

A CDN is like stocking each branch with pre-made meals. Edge computing is like giving each branch a small kitchen that can finish a few dishes on the spot. Complex recipes still happen in the main kitchen, but a lot of simple orders never need to leave town.

What runs at the edge

Typical jobs:

  • Redirects and rewrites. Sending old URLs to new ones before they ever reach your server.
  • Personalisation. Showing different content by country or language.
  • Security checks. Blocking bad bots or checking tokens near the user.
  • A/B tests. Choosing which variant a visitor sees, without flicker.
  • Header changes. Adding security headers at the edge.
  • Small APIs. Returning quick answers, such as a price lookup or a form handler.
  • Image resizing and caching rules.
  • Whole sites. Static and server-rendered pages served from edge locations.

Platforms offering this include Cloudflare (Workers, which I covered in Cloudflare Workers explained simply), Vercel, Netlify, Fastly and AWS (Lambda@Edge and CloudFront Functions), among others. They differ in limits and pricing; check current details for the one you’re considering.

How it relates to “serverless”

Edge functions are usually a kind of serverless: you write a small piece of code and the platform runs it when needed, without a server for you to manage. The difference is location. Ordinary serverless runs in a region you pick; edge runs in many places at once. See serverless explained without jargon.

What it’s good for

  1. Speed for global audiences. Less distance, lower latency. If your audience is spread out, or far from your main server, the gain is real. For background on why distance matters, see bandwidth vs latency vs throughput.
  2. Taking load off your server. Answers that never reach the main server cost it nothing.
  3. Resilience. If your origin goes down, cached or edge-generated responses may still be served for a while.
  4. Security. Stopping junk closer to where it starts.
  5. Flexibility. Changing how a site behaves without touching its core software.

What it isn’t good for

  • Heavy work. Large database operations and long-running jobs still belong on a proper server.
  • Data that must be in one place. Keeping data consistent when copies sit all over the world is hard, which is why many setups keep a central database.
  • Replacing good basics. A slow, bloated page is slow at the edge too. Fix images and scripts first.
  • Small local audiences. If everyone visiting is near your server, the benefit is smaller.

Why a normal site owner should care

You may never write edge code, and you’re probably using the edge already. If your site sits behind Cloudflare, you’re using its network. If you host on a modern static platform, your pages are served from edge locations.

Where it becomes practical:

  • WordPress with a CDN and full-page caching at the edge makes a slow server feel much faster to visitors in other countries. See caching explained and Cloudflare explained.
  • Redirects. Large redirect lists handled at the edge can ease the load on WordPress.
  • Country-based rules, such as showing a regional notice or blocking a country you can’t serve.
  • Static hosting. For simple sites, static hosting puts the files at the edge by default.

For Nigerian and other African audiences, distance has a real effect when the main server is in Europe or the US. Edge locations on the continent are fewer than elsewhere, so the benefit is real but varies by provider and city. Test from where your visitors are.

Things to watch

  • Cache confusion. Edge caching can serve an old version after you update. Learn how to purge it.
  • Debugging. Problems can come from the edge, the origin or the browser. Make changes one at a time.
  • Lock-in. Code written for one provider’s edge may not move easily.
  • Privacy. Where is data processed, and does that matter for your visitors’ laws?
  • Cost. Free tiers are generous, but usage-based pricing can surprise you.

Common myths

  • “Edge makes everything faster.” Only the parts that run or cache at the edge.
  • “Edge replaces my host.” Usually it sits in front of one.
  • “It’s only for developers.” A CDN setting is edge computing in its simplest form.
  • “Edge is the same as 5G or edge devices.” The word is also used for processing on devices and local equipment. Here we mean network locations near users.

Key takeaways

  • Edge computing runs code and caches data close to users, instead of in one central place.
  • It builds on the CDN idea, adding the ability to execute small programs.
  • It helps most with global audiences, redirects, personalisation and security checks.
  • You likely use it already via a CDN; start there before writing any edge code.

Where do most of your visitors live, and where does your server sit?