What is Edge Computing?
For years, web architectures moved toward centralized cloud data centers. While this simplified deployment, it introduced latency. If a user in Tokyo requests data from a server in Virginia, the request must travel thousands of miles, taking hundreds of milliseconds.
Edge Computing pushes computation and data storage away from centralized cloud data centers and closer to the physical location of the user—at the “edge” of the network.
Edge Rendering vs. SSR
Edge runtime platforms (like Cloudflare Workers, Vercel Edge, and AWS Lambda@Edge) allow developers to execute server-side logic globally. This enables:
- Edge SSR (Server-Side Rendering): Generating pages dynamically at the nearest edge server, resulting in near-instant load times.
- Personalization at the Edge: Customizing content, checking cookies, and handling redirects instantly without hitting the origin server.
- Globally Distributed APIs: Processing API requests locally and syncing data to primary databases asynchronously.
// Simple Cloudflare Worker routing request at the edge
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const country = request.cf.country;
return new Response(`Welcome user from ${country}!`, {
headers: { 'content-type': 'text/plain' }
});
}