System Design Cases
Edge Computing
Edge computing patterns: compute at PoPs (Cloudflare Workers V8 isolates, Vercel Edge, Lambda@Edge, Fastly Compute@Edge WASM, Deno Deploy). Three scenarios: edge auth (verify JWT before forwarding), A/B routing with sticky cookie, image resize on demand. Three ADRs cover edge-vs-origin compute, V8 isolates vs WASM vs containers, and KV at edge vs origin DB.
Edge computing: nearby execution, explicit data distance
An edge runtime can reduce the client-to-compute leg. It cannot repeal network distance to authoritative data, make every store globally writable, or promise a fixed latency. Routing, cold state, queueing, storage location and provider limits all affect observed percentiles.
Runtime and concurrency
Cloudflare Workers isolates can handle interleaved requests, may be evicted, and are not guaranteed to receive the next request for a user. Global mutable variables are therefore neither durable storage nor a synchronization primitive. Use a named durable coordinator or transactional store for shared effects and stable operation IDs for ambiguous retry.
Data choices
- Workers KV is read-optimized and eventually consistent. Remote cached values, including negative lookups, can remain stale; concurrent writes can overwrite.
- D1 has one write primary. Read replicas update asynchronously. Sessions and bookmarks provide sequential consistency for a logical session.
- A worker near an Asia user that queries a US database still pays the WAN and database round trips. Measure, co-locate, reduce chattiness, or choose a data model whose consistency contract fits.
No scenario references an implicit or nonexistent regional node: every runtime target and hop is present in the topology.