Lesson 7 of 9 · 23m
Latency Budgets and Performance Engineering at the Edge
Turn vague performance goals into millisecond budgets across DNS, TLS, edge compute, upstreams, rendering, and third-party dependencies.
“Fast” is not an engineering target. A latency budget is. Without one, every dependency owner assumes somebody else is slow, every optimization becomes a vibes contest, and the first incident review devolves into percentile bingo. Edge systems make budgets more important because they expose network topology rather than hiding it inside one data center.
Budget the user-visible milestone
Start with the outcome, not the component. For example: a repeat visitor in the target region should receive first meaningful HTML in 500 milliseconds at p75 on a normal connection. Then allocate:
DNS + routing 30 ms
TCP + TLS 60 ms
edge compute 40 ms
cache/upstream data 150 ms
response transfer 80 ms
browser parse/render 140 ms
reserve 100 ms
total 600 ms worst-path allowanceYour numbers will differ. The important part is explicit ownership and measurement. A component does not get to consume the reserve merely because it was convenient.
Percentiles describe different users
p50 tells you what the typical healthy request feels like. p95 tells you what happens to users on worse networks, colder paths, or moments of dependency stress. p99 often exposes retries, queueing, and tail amplification. Optimize p50 by removing work. Optimize tail latency by removing variance: fewer serial dependencies, bounded timeouts, stable cache behavior, and controlled retries.
single dependency at p95 = 200 ms tail risk noticeable
three serial dependencies tail risk multiplies
three parallel bounded dependencies tail risk governed by slowestParallelism is useful, but it is not free; unbounded fan-out can overload upstream services exactly when they are least healthy.
Measure from user geography
Synthetic tests from one cloud region lie politely. They show a stable, nearby, well-connected client that many users do not have. Measure from target markets, real devices, and realistic network profiles. RUM data is messy but truthful in aggregate:
navigationStart
connectEnd
responseStart
firstContentfulPaint
largestContentfulPaintCorrelate those milestones with edge decision metadata such as cache status, selected upstream, experiment assignment, and application version. Otherwise you cannot explain movement.
The hidden cost of third parties
Edge platforms can make your code fast while tag managers, font CDNs, fraud vendors, personalization scripts, and payment iframes consume the budget from the browser side. A server-side p95 of 90 milliseconds does not save a page blocked for two seconds by third-party JavaScript. Put third parties in the budget and assign an owner empowered to remove them.
Performance is an architectural feedback loop
When a dependency misses its allocation, do not merely tune it. Ask whether it belongs in the critical path. Can it be precomputed, cached, streamed, deferred, made asynchronous, or replaced with a pessimistic default plus eventual correction? Edge architecture is often the art of moving decisions earlier without making them wrong.
Field notes
- Timeouts without deadlines are useless. Propagate remaining budget downstream rather than restarting a fresh timeout at every hop.
- Do not compare only averages. Averages hide multimodal behavior such as cache hit versus cache miss.
- Cold-start improvements do not compensate for bloated JavaScript shipped to every client.
- Revisit budgets after feature launches; silent budget drift is how fast systems become slow without any single bad commit.
Was this lesson helpful?