]> git.kaiwu.me - haproxy.git/commit
MEDIUM: cache: emit early hints if configured to do so
authorMaxime Henrion <mhenrion@haproxy.com>
Fri, 26 Jun 2026 20:44:50 +0000 (16:44 -0400)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Jul 2026 14:42:35 +0000 (16:42 +0200)
commit25fcee5b0c72006c682a36c1b1925384bd892275
tree9c5bbf94eb6501473d3af7febf26d0ef2321a1dd
parent7f3c30d96c3b5f94750b2f96a810f34feef469de
MEDIUM: cache: emit early hints if configured to do so

The HTTP cache now supports sending 103 Early Hints responses if
enabled, without the need for explicit per-rule configuration.

Two paths feed the 103 response depending on the matched entry. A
stripped entry (CACHE_EF_STRIPPED) carries its Link records
pre-extracted alongside the cache entry header and is copied out of
the row as-is. A complete entry only carries the cached HTX; the
Link headers are walked on the fly at request time, deliberately
avoiding the extra storage cost of duplicating them alongside the
body.

The on-the-fly path has a cost: a workload where many hits land on
expired complete entries re-parses the cached response on each hit.
To bound this, the first such hit also strips the entry in place
when conditions allow (the hints pool is below its cap, and the row
is not currently being read by another request); subsequent hits for
the same URL then take the cheap pre-extracted path.

To let the cache-use lookup reach that logic, get_entry() now returns
expired entries to callers passing delete_expired=0; such callers are
responsible for checking entry->expire themselves.
src/cache.c