LOAD-BEARINGfree
High-level designTier 10 · unit 6 of 6 · 15 min read

The edge as a place code runs

Lesson 4.03 put a CDN in front of the origin and treated the edge as a cache: bytes held close to users, invalidated on write. Edge compute keeps the geography and changes the verb. Your code runs in the point of presence nearest the user — three hundred of them rather than three regions — and the question stops being what to cache and becomes what can be decided without going home.

What genuinely belongs there

Anything answerable from the request alone. Validating a signed token, bucketing a user into an experiment, rewriting a URL, choosing a locale, blocking a bot, stitching personalised fragments into cached HTML, deciding which origin to route to. These share a shape: a decision costing two milliseconds of CPU that currently costs a hundred and fifty milliseconds of round trip because the code making it lives in Mumbai and the user is in São Paulo.

That is a real and underused win, and it is worth being precise about why it is available: you are not making anything faster, you are removing a trip. The saving is bounded by the round trip you eliminate, which is why moving a decision to the edge helps enormously and moving a computation there usually does not.

The runtime is a subset, and that is the adoption barrier

Edge platforms do not run containers. They run isolates or WebAssembly modules with millisecond start-up, and they buy that by taking things away: a few tens of milliseconds of CPU per request, tens of megabytes of memory, no filesystem, no long-lived connection pool, and a standard library narrower than the one your service is written against. Your ORM does not run there. Neither does the SDK for your database.

This is the actual reason edge projects stall, and it is better discovered at design time than three sprints in. The correct read is that the edge is a different tier with a different programming model, not a cheaper place to put the existing service.

State, which is where the difficulty lives

Three shapes are on offer, and they are not interchangeable.

  • Edge key-value. Replicated to every location, eventually consistent, with propagation measured in seconds. Excellent for data that is read constantly and written rarely: feature flags, routing tables, redirect maps, public keys, configuration. The staleness window is the whole product — if you can name it and defend it, this is the best tool on the page.
  • Single-home coordination objects. A named actor that exists in exactly one location, giving you serialisable operations on that key. Genuinely useful, and it has a consequence people skip: the object lives somewhere, so a user far from it pays the full round trip. You have not removed the trip, you have moved it — from every user to origin, to the users who are far from that particular key.
  • Regional replicas with one write region. Local reads, remote writes. Lesson 6.01's PACELC trade, unchanged, now distributed across many more replicas on worse links than a multi-region design (Lesson 14.01) would use.

Underneath all three sits a fact no platform removes: strongly consistent, globally low-latency, writable state is not on the menu. Spreading state across three hundred locations makes that harder than spreading it across three, because the number of replicas went up by two orders of magnitude and the network between them got worse. The design rule that survives is to push decisions outward and keep truth in a small number of places you can reason about.

Two consequences that arrive later

The billing model inverts. Edge compute is charged per request and per CPU-millisecond, so a chatty design that costs nothing on hardware you already rent becomes a line item, while the origin traffic you stop sending is egress you stop paying for (Lesson 14.02). The arithmetic can land either way and it is worth doing before the migration rather than after the first invoice.

Observability gets harder in a new way. Three hundred locations, no host to log into, no process to attach a profiler to. You have exactly the telemetry you chose to ship (Lesson 9.01), and a bug that only reproduces in one point of presence — because of one upstream network, one stale deployment, one regional quirk — is an operational category that did not exist when everything ran in three availability zones.

The trap

Using edge key-value as a database because the API looks like Redis. Someone puts a rate-limit counter in it, or a per-user quota, and it passes every test — because in testing one location served every request. In production the same user reaches three locations, each holding its own stale copy, and the limit admits roughly three times what it promises while last-write-wins quietly discards the other two increments. Nothing errors. Rate limiting at the edge is a legitimate design, but it requires changing the algorithm to tolerate per-location counting (Lesson 9.03) and stating the real limit as a range, not pretending a replicated eventually-consistent store is a shared counter.

The tradeoff sheet

Problem solved
A decision that takes two milliseconds of compute but a hundred and fifty of round trip, because the code making it lives one continent away.
Rejected, and why
Regional deployments cut the distance with an unchanged programming model. A CDN with smarter cache keys solves a good share of it with no code at the edge at all.
The trade
A restricted runtime that will not run your existing service, and state that is either eventually consistent everywhere or authoritative in exactly one place.
First to break at 10x
State assumptions. At 10x, per-location counters and caches diverge visibly, and anything that assumed a single view of the world is now wrong in three hundred places.
What it does to the bill
Per request and per CPU-millisecond, which punishes chatty designs, offset against origin egress you stop paying. Model both before migrating.
Day-2 operations
No host to log into and no profiler to attach. Ship structured telemetry with the location attached, or a bug in one point of presence is undiagnosable.

The nuance

“Isolates or WebAssembly modules with millisecond start-up.”

True for a warm location, which is most of them most of the time. A location that has not served your code recently has evicted it, and the first request there pays fetch and compile — and a fresh deployment is cold everywhere at once. The cold-start figure quoted in the marketing is a median across a warm fleet; the number that shows up in your p99 is the one from the locations serving your least traffic.