Edge Computing
In short
Edge computing runs code and processes data close to where users or devices are, instead of in a distant central data center, to reduce latency.
What is edge computing?
Edge computing moves computation away from a few large, central data centers and toward the edge of the network, closer to the people and devices that produce the data. The edge can be a server in a nearby city, a small data center at a telecom tower, a gateway in a factory, or even the device itself. Because data travels a shorter distance, responses arrive faster and less traffic has to cross the internet.
In web development, edge computing usually means small functions deployed to hundreds of locations worldwide, often on the same network as a CDN. A request from a user in Tokyo is handled in or near Tokyo, where an edge function can check authentication, redirect by country, personalize a cached page, or pick an A/B test variant before the response is sent. Edge runtimes start in milliseconds, but they restrict what code can do, for example by limiting execution time, memory, and some APIs, and the data a function needs may still live in one central region.
Outside the web, edge computing is common in the Internet of Things, where cameras, sensors, and machines produce too much data to send everything to the cloud, so an edge device filters or analyzes it locally and uploads only the results. Factory robots, vehicles, and retail stores rely on it when decisions must be made in milliseconds or must keep working if the internet connection drops. It is like a chain of neighborhood branch offices that handle everyday requests on the spot and send only the difficult cases to headquarters.
Edge computing is often confused with a CDN. A classic CDN caches and serves copies of static files, such as images and scripts, from edge servers, while edge computing runs your own code at those locations to produce responses. It is not the opposite of cloud computing either: most edge platforms are run by cloud providers and work together with central cloud regions that hold the main databases.
Key takeaways
- Edge computing runs code close to users or devices to reduce latency and bandwidth use.
- On the web, edge functions run in many locations, often on CDN networks.
- In IoT, edge devices process data locally and send only results to the cloud.
- Edge runtimes start fast but limit execution time, memory, and available APIs.
- A CDN caches content at the edge; edge computing runs custom logic there.
Example
// Runs in the location closest to each visitor
export default {
async fetch(request) {
const url = new URL(request.url);
// Edge platforms pass the visitor's country in a header (name varies)
const country = request.headers.get("x-country") ?? "US";
if (url.pathname === "/" && country === "DE") {
return Response.redirect(new URL("/de/", url), 302); // answered at the edge
}
// Everything else is forwarded to the origin server
return fetch(request);
},
};Readers ask
What is the difference between edge computing and cloud computing?
Cloud computing usually runs workloads in a small number of large, central data center regions. Edge computing runs them in many smaller locations close to users or devices, and the two are typically combined, with the edge handling fast, local work and the cloud holding central data.
What is an edge function?
An edge function is a small piece of server-side code deployed to many locations around the world and run in the one nearest to each request. It is often used for redirects, authentication checks, personalization, and changing headers.
Is edge computing the same as serverless?
Not exactly, but they overlap. Edge functions are usually serverless because you don't manage the servers, but ordinary serverless functions often run in a single cloud region, while edge functions run in many locations at once.
See also
- CDNDevOps & Cloud, p. 7A CDN is a network of servers spread around the world that stores copies of website content and delivers it to each user from the nearest location.
- Cloud ComputingDevOps & Cloud, p. 10Cloud computing is the on-demand delivery of computing resources, such as servers, storage, and databases, over the internet with pay-as-you-go pricing.
- ServerlessDevOps & Cloud, p. 47Serverless is a cloud model in which the provider runs your code on demand, manages all the servers, scales automatically, and bills only for actual use.
- LatencyNetworking, p. 14Latency is the delay between sending a request and the start of a response, usually measured in milliseconds, and it shapes how responsive an app feels.
- Reverse ProxyDevOps & Cloud, p. 44A reverse proxy is a server that sits in front of web servers, accepts client requests on their behalf, and forwards each request to the right backend server.
Spotted a mistake or something missing on this page?Suggest an edit