Description
From the 2026-07-05 performance & architecture review (HTML cacheability section).
There is no CacheOverride, set_ttl, or cache API call anywhere in the repo. Origin fetches forward client cookies, and typical origins mark HTML private, so the readthrough cache passes. Every pageview is a full origin round trip plus a full rewrite cycle regardless of SSAT. The design doc's two-layer model (cached origin template + per-request assembly) is the correct target; it just needs to be built.
Fix
- Cache the origin HTML template explicitly (core cache or readthrough override) keyed by URL + host + variant, with cookies stripped from the template fetch, TTL + stale-while-revalidate. Origin load drops to roughly requests-per-URL-per-TTL.
- Go further and cache the transformed, auction-independent HTML. The rewrite output minus the two injected scripts is per-URL, not per-user. Late-bind only the bid splice per request. This eliminates the dominant per-request CPU too.
- Add
Surrogate-Key emission and purge hooks so CMS purges propagate; today a stale cached origin object is uncontrollable except by TTL.
- Keep
response_privacy.rs and the private, max-age=0 downgrade exactly as they are; the caching work sits upstream of them.
Effort / expected effect
- Effort: Medium/Large
- Expected effect: Origin RTT off the hot path; kills dominant per-request CPU.
Sequencing item 6 of 10.
Description
From the 2026-07-05 performance & architecture review (HTML cacheability section).
There is no
CacheOverride,set_ttl, or cache API call anywhere in the repo. Origin fetches forward client cookies, and typical origins mark HTML private, so the readthrough cache passes. Every pageview is a full origin round trip plus a full rewrite cycle regardless of SSAT. The design doc's two-layer model (cached origin template + per-request assembly) is the correct target; it just needs to be built.Fix
Surrogate-Keyemission and purge hooks so CMS purges propagate; today a stale cached origin object is uncontrollable except by TTL.response_privacy.rsand theprivate, max-age=0downgrade exactly as they are; the caching work sits upstream of them.Effort / expected effect
Sequencing item 6 of 10.