Software architecture guide

Edge Compute Architecture: Safe, Fast, Provider-Neutral Design

Put deterministic delivery decisions near the user while keeping authority, private state, and expensive work in the systems designed to own them.

Published
Updated
Reading time
11 min read
On this page

Edge compute can normalize a request, choose a public representation, enforce a route limit, or route to a healthy origin before an application server is involved. It improves delivery only when its work is bounded and its authority is explicit. It is not a reason to move payment, inventory, identity, or unbounded data work into every request path.

This discipline matters even more once the same edge compute architecture must hold across more than one provider or region. A managed edge orchestration layer keeps route classification, cache policy, and state boundaries enforced consistently, with MYO giving one team a single, provider-neutral edge design view of where a request stopped and why.

Overview

Outcome

Design a portable edge path that safely serves public cache hits, protects a private origin, and makes its hit, miss, rejection, and fallback decisions observable.

Overview

Prerequisites

  • A public hostname, TLS certificate, and a documented origin owner.
  • A route inventory that marks public, authenticated, and write paths.
  • Edge-to-origin authentication or private connectivity, plus a tested rollback path.
  • Edge and origin logs that share a request or trace ID.

Scenario: Acme Shop's edge compute architecture separates the fast path from authority

Acme Shop serves product pages in several regions. GET /products/{slug} is public and can tolerate a five-minute representation. Cart, account, and checkout routes cannot be shared-cached and must reach the authoritative application. Acme's edge compute architecture normalizes harmless marketing parameters, serves a public hit when available, and sends a bounded miss through an origin shield. Its origin denies direct public traffic and accepts only its delivery path.

Acme Shop request boundary
  1. Customer

    Requests a public product page or a private journey.

  2. Edge policy

    Classifies the route and removes untrusted forwarding headers.

  3. Public cache

    Answers only an approved public representation.

  4. Origin shield

    Collapses eligible misses before the private origin.

  5. Private origin

    Accepts only the trusted delivery path.

  6. Authoritative data

    Owns private state and write correctness.

Public product representations can stop at the edge; authenticated and write routes pass through the trusted delivery path to the authoritative origin.

1. Classify the route before choosing a cache policy

Use a short route contract, not a provider-specific rule name. A safe default is to deny shared caching unless a route has an explicit public representation.

Route classEdge actionShared cacheAuthority and failure behavior
Public product pageNormalize and look upYes, key by path and approved localeServe a previously approved stale page only if product owners accept it.
Search suggestionRate-limit and look upUsually short-livedOrigin remains authoritative; return a bounded unavailable response if needed.
Account or cartPass through with private headersNoAuthenticate and read at the application.
Checkout or payment callbackPass through with strict limitsNoUse the authoritative service; never turn an uncertain write into a cache hit.

The edge must remove client-supplied forwarding identity headers and set its own trusted values at the proxy boundary. Do not use client IP as an authorization principal.

2. Define a minimal, provider-neutral cache contract

For Acme's public product page, the cache key is normalized path plus the selected locale. It excludes tracking parameters, cookies, authorization headers, and unbounded query strings. The application sets the semantic policy; the edge only implements it.

GET /products/trail-pack?utm_source=newsletter HTTP/1.1
Host: shop.example.com
Accept-Language: en-US,en;q=0.9

HTTP/1.1 200 OK
Cache-Control: public, max-age=60, s-maxage=300, stale-while-revalidate=60, stale-if-error=300
Vary: Accept-Language
Content-Type: text/html; charset=utf-8
Representative edge decision output
request_id=req_01H... route=product-page
cache_key=/products/trail-pack|locale=en
cache_status=HIT age=42 origin_contacted=false
response_cache_control="public, s-maxage=300"

stale-while-revalidate and stale-if-error are product decisions, not availability defaults. Acme may use them for a description or image, but not for stock, price confirmation, entitlement, account data, or checkout state. Responses with Set-Cookie, Authorization, customer-specific data, or a private cache directive do not enter the shared namespace.

Size the miss path

If a route receives R requests per second and its edge hit ratio is H, the initial origin demand is approximately R x (1 - H). At 1,000 requests/s and 95% hits, Acme plans for about 1,000 x 0.05 = 50 cache misses/s before considering purge or cold-cache spikes. Request collapsing matters because 500 simultaneous requests for one expired key should create one upstream fetch, not 500.

Set an origin concurrency budget that is lower than the origin's safe saturation point. A shield, per-key coalescing, short upstream deadline, and zero or one carefully justified retry protect the origin when the estimate is wrong.

Collapsing is usually scoped per key, per edge location, not globally. If Acme launches across twelve active locations at once, a cold key can still generate up to twelve simultaneous origin requests — one per location — even though each collapsed correctly on its own. The R x (1 - H) estimate is a steady-state lower bound, not a launch-day ceiling; size the shield's concurrency budget against the number of locations that can miss at once, and pre-warm high-traffic keys before a known launch.

3. Make direct-origin access fail closed

The edge is a delivery layer, not an origin firewall. Acme implements the following controls using the equivalent facilities of its provider, cloud, or network:

origin-access-policy:
  public-ingress: deny
  allowed-callers:
    - private-delivery-network
    - edge-service-identity
  required-request-properties:
    - authenticated-edge-to-origin-connection
    - edge-generated-request-id
  rejected-client-headers:
    - x-forwarded-for
    - x-forwarded-host
  route-limits:
    /checkout:
      methods: [POST]
      shared-cache: false
      request-body-max: 64KiB
      origin-timeout: 2s

Do not treat an allowlist of changing delivery IP ranges as the only proof of origin identity. Prefer private connectivity or a mutually authenticated, rotated edge service identity when the platform supports it. Keep a break-glass rollback that restores the prior reviewed policy, not an unrestricted public origin.

4. Validate success, failure, and recovery

Run these tests on a staging hostname or a narrow canary before a global rollout. Use approved test accounts and sanitized request IDs only.

TestExpected resultEvidenceRecovery check
Public product cache hit200, cache_status=HIT, no origin requestEdge decision and origin request countPurge one test key; next request is one coalesced miss, then a hit.
Authenticated cart request200 only from application; not shared-cachedCache-Control: private or no-store; no shared-cache recordSign out and retry; no prior cart representation appears.
Direct origin requestDenied before the application handles itOrigin firewall or access log contains the denialRestore the prior trusted route if an approved edge request is unexpectedly denied.
Bounded origin failureSafe stale public page or documented 503; no retry stormUpstream duration, retry count, cache statusRe-enable the canary origin; confirm traffic returns gradually and stale serving stops.
Read-after-write on a state storeA read after a write returns the new value, via the authoritative path or a matched version tokenEdge log shows the read routed to the authoritative path, or the token matchedRemove the temporary override once propagation is confirmed; normal routing resumes.

5. Define edge state boundaries for consistency and residency

Everything so far treats the edge as authority-free: it classifies, caches, and forwards, but does not own data. Edge platforms increasingly offer state primitives close to the request — regional key-value stores, single-writer coordination objects — and it is tempting to reach for them simply because they are close and fast. Edge state boundaries are the rules that keep that convenience from becoming a correctness or compliance problem.

Choose edge state by consistency and residency needs

The closer a data item gets to identity, jurisdiction, or strict write correctness, the less suitable it is for a broadly distributed edge store.

Download:PNGSVG

Match the store to the consistency the data needs

Edge-adjacent stores come in two shapes. An eventually consistent store replicates a value to many locations with a propagation lag, often seconds; it suits feature flags or a cached entitlement hint. A strongly consistent, single-writer store routes every key's operations through one authoritative place, at the cost of latency, for a write that must be visible everywhere instantly; it suits a rate-limit counter or an idempotency record. Treat the choice as a per-data-class decision, recorded like Acme's cache contract:

edge-state-policy:
  product-catalog-flag:
    store: eventually-consistent-regional
    max-staleness: 30s
    residency: any
  checkout-idempotency-key:
    store: strongly-consistent-single-writer
    max-staleness: 0s
    residency: customer-region
  customer-profile-pii:
    store: origin-only
    max-staleness: n/a
    residency: eu-only

Design for read-your-writes, not just eventual convergence

A customer who updates a saved address and immediately reloads can land on a different edge location than the one that accepted the write, and see the change as lost until propagation catches up. Handle this deliberately: route the post-write read through the authoritative path for a bounded window, attach a version token the client echoes back so the edge can detect staleness, or document the window as accepted behavior. Leaving it undecided turns a platform detail into a support ticket.

Treat jurisdiction as a state boundary too

Acme Shop's EU launch adds a boundary unrelated to cache freshness: profile and order data from EU visitors must stay inside the EU, even though the same product-page edge locations serve customers worldwide. Extend the route-classification table from Section 1 with a residency column, and audit the state store and any outbound call an edge function makes on a regulated route. A violation here is not only a wrong answer; it can be a compliance incident.

Make state-boundary decisions visible across every provider

A consistency model, a staleness budget, and a residency rule are usually configured separately, on whichever provider hosts the store — so a multi-provider path can quietly give three different answers to "is this value current." Optimi's managed edge orchestration keeps that policy declared once and observed through MYO, so an exception surfaces as one incident with one owner, not a mismatch found in production.

Bound the compute, not just the state

Edge compute instances are typically short-lived and CPU-time constrained by design, often a default budget measured in tens of milliseconds. Do not rely on an in-memory variable or open connection surviving between invocations; treat every invocation as stateless unless it explicitly reads from a state store above. This constraint also keeps an edge compute architecture portable across a change of provider.

Troubleshooting

SymptomLikely causeSafe checkRecovery
Personalized content appears on a public pageCache key omitted a representation dimension or a private response was marked publicInspect sanitized cache headers and key dimensionsDisable shared cache on the route, purge affected keys, then fix and test the contract.
Origin load rises after a purgeMisses are not collapsed or the shield is bypassedCompare unique cache keys with upstream requestsRe-enable coalescing, limit purge scope, and warm only approved public keys.
Legitimate requests receive origin denialEdge identity, host, or proxy header policy changedCorrelate edge request ID with the origin denial reasonRoll back only the recent access-policy change and retest the trusted path.
Stale product pages persist too longTTL, purge scope, or response headers conflictInspect response Age, cache status, and deployment versionCorrect the response policy, purge the precise representation, and verify propagation.
Traffic flaps between originsHealth check is too shallow or has no hysteresisCompare journey health with steering eventsAdd route-level health criteria, dwell time, and a measured recovery threshold.
Cart update vanishes after a writeRead hit a replica that had not yet received the updateCompare the write's timestamp against the replica's last-sync timeRoute the post-write read through the authoritative path, or check the version token.
Customer data shows a processing region outside its jurisdictionAn edge function or state store ran outside the approved residency boundaryCompare execution and storage region fields against the approved listPin the route's compute and storage to the approved jurisdiction; audit until no exception remains.

Authoritative references

Make edge compute architecture fast without making it fragile

Discuss provider-neutral edge design, cache safety, origin controls, and edge state boundaries — observed end-to-end through MYO's Performance, Security, and Visibility lens — with Optimi experts.

Discuss edge architecture