Skip to content

CONCEPT Cited by 4 sources

Hot path

The hot path is the code that runs on every (or near-every) request, especially at high request rates. It's the call chain whose per-invocation cost is multiplied by the request rate and shows up directly in p50/p95/p99 latency and total CPU.

Why it's the unit of optimization

  • At 1k req/sec, a 1 µs helper costs 1 ms/sec of CPU — 0.1 % of one core. Nobody cares.
  • At 1M req/sec, the same 1 µs helper costs a full core.
  • At 35 M req/sec (the pingora-origin scale), a 1 µs helper costs 35 cores; a 4 µs helper costs 140 cores.
  • A seemingly-trivial one-line helper (clear_internal_headers) was 1.71 % = ~680 cores.

At CDN scales the hot path is the only place where engineering micro-optimization pays real dividends — cold-path work dominates only on individual requests, not on fleet CPU budgets.

Canonical Cloudflare framing

Any code that has to be run per-request is in the hottest of hot paths.

If a function participates in every request lifecycle, it gets first-class optimization attention, even if the per-request cost is "only" microseconds.

Typical hot-path optimization moves

  1. Flame-graph / stack-trace sampling (concepts/stack-trace-sampling-profiling) to find the high-CPU-share helpers.
  2. Flip lookup direction if two collections meet at a membership test (patterns/flip-lookup-direction).
  3. Change the data structuretrie over hashmap on miss-heavy short keys, flat sorted Vec over BTreeMap at small N, etc.
  4. Custom crate when off-the-shelf options don't match the workload shape (patterns/custom-data-structure-for-hot-path).

Front-end hot path (GitHub, 2026)

The "code that runs on every request" framing generalizes to UI: code that runs on every interaction / every frame / every rendered item is the front-end hot path. GitHub's PR Files-changed tab rewrite is the canonical wiki instance at the web-UI substrate:

Seen in

Last updated · 200 distilled / 1,178 read