← Lessons

quiz vs the machine

Gold1420

System Design

Edge Compute and Workers

Running code at the edge, close to users, instead of at a central server.

5 min read · core · beat Gold to climb

Beyond Static Caching

Edge nodes used to only cache files. Edge compute lets you run small programs, often called workers, on those same nodes. Logic executes near the user, so responses avoid a round trip to a distant origin.

What Workers Do Well

  • Rewriting requests and responses, such as adding headers or routing
  • Personalization like geolocation, A B testing, or feature flags
  • Authentication checks before a request ever reaches origin
  • Assembling responses from multiple cached fragments

Constraints

Workers run in lightweight isolates, not full containers, so they start in milliseconds but face limits.

  • Short execution time budgets per request
  • Limited memory and no long lived local state
  • No heavy dependencies since the runtime is sandboxed

State usually lives in an edge key value store or is passed to origin.

Key idea

Edge compute runs lightweight workers on CDN nodes so request rewriting, auth, and personalization happen near the user, trading rich runtimes for millisecond startup and tight resource limits.

Check yourself

Answer to earn rating on the learn ladder.

1. What is a typical good use of an edge worker?

2. Why do edge workers have tight resource limits?