Distributed systems / Edge computing

Edge computing

A user in Sydney, a server in Frankfurt, and 16,500 km between them. See what distance costs, how running code near the user removes it, and what the edge cannot do.

Beginner7 steps~6 min
User — in Sydney, waiting for a page
Edge site — small servers close to the user
Origin — the main servers and the database
// THE SHORT VERSION

In 30 seconds

Edge computing means running code on small server sites spread across many cities, close to users, instead of only in one distant data centre.

The gain is latency. Signals need time to cross the planet, and a page load needs several round trips, so answering from 100 km away instead of 16,500 km turns half a second into a few milliseconds.

The price: edge sites are small, and your data usually lives elsewhere. The edge suits quick, light work; shared data and heavy jobs stay at the origin.

Edge computing, step by step

STEPS01 / 07

Travel times use the straight-line distance and ignore processing, so real figures are higher. “Edge” also covers devices and gateways on site, such as in factories, not only provider sites.

STEP 01 / 07 Far away is slow
THE MATH
round trip = 2 × 16,500 km / 200 km/ms = 165 ms
  1. Step 1: Far away is slow. A user in Sydney opens a site whose only server, the origin, is in Frankfurt, 16,500 km away. Signals in glass fibre cover about 200 km per millisecond, so a question and its answer need at least 165 ms just to travel. No faster server can shrink that. Only a shorter distance can.
  2. Step 2: Round trips add up. Loading a page is not one exchange. The browser first opens a connection, then sets up encryption, then asks for the page: three round trips before anything arrives. At 165 ms each, half a second is gone before the first byte of the page shows up.
  3. Step 3: Move the server closer. Edge computing puts small server sites in many cities, close to where users are, in front of the far-away origin. If the nearest site is 100 km from the user, a round trip takes about 1 ms and the three trips together take 3 ms instead of 495.
  4. Step 4: Edge functions. An edge site can do more than hand out stored copies of files. An edge function is a small piece of your own code, copied to every site and run there on each request. This one picks the Australian version of a page and answers from 100 km away, without asking the origin at all.
  5. Step 5: Limit: the data is far. Speed lasts only while the function needs nothing from far away. The shopping cart lives in the database at the origin, so reading it costs the long trip again. Copying data to every site helps, but copies cannot all change at the same instant, so some sites briefly show an old value.
  6. Step 6: Limit: small machines. An edge site is small and shared by thousands of customers’ functions, so each one gets a thin slice: often around 128 MB of memory, a cap on processor time per request, and a start-up measured in milliseconds. Exact limits vary by provider. Long or heavy jobs still belong at the origin.
  7. Step 7: What goes where. Work that is quick and needs little shared data suits the edge: serving cached pages and video, redirects, checking login tokens, blocking bots, or a factory gateway reacting to a sensor on the spot. Orders, payments and heavy computing stay at the origin. Most systems use both.
VALUES SO FAR
distance16,500 kminput
fibre200 km/msrule
1 trip165 msorigin
3 trips····origin
edge at····input
3 trips····edge
via data····limit
memory····limit

Spotted a mistake on this page?