Skip to content

docs: document disable_surrogate_key - #141

Open
rhurling wants to merge 1 commit into
caddyserver:masterfrom
rhurling:docs/disable-surrogate-key
Open

docs: document disable_surrogate_key#141
rhurling wants to merge 1 commit into
caddyserver:masterfrom
rhurling:docs/disable-surrogate-key

Conversation

@rhurling

@rhurling rhurling commented Jul 25, 2026

Copy link
Copy Markdown

This PR and all of the following text is written by Claude, after debugging a production incident as mentioned.

disable_surrogate_key has been parsed since the souin v1.7.7 bump (configuration.gocfg.SurrogateKeyDisabled) but is not mentioned in the README, so it is effectively undiscoverable. In #118 and #127 it only surfaced through maintainer comments.

It is the right escape hatch for anyone who never invalidates by surrogate key, and it matters most on high-cardinality workloads: maintaining the index is a read-modify-write of an index entry on every cache store, so the cost of storing a response grows with the number of responses already indexed. That is the mechanism behind #114, #118 and #127 — I hit it in production and wrote up the measurements in #127 (comment).

Setting it resolved the problem for me with no change to caching behaviour: responses are still stored and served from cache, only the surrogate bookkeeping is skipped.

This adds the option to the global options example and a short section covering what it does and when to reach for it.

Documented under Global Option Syntax only. The parser also accepts it in the per-directive cache {} block, but I have only verified the global form in production, so I have not claimed the other.

Related: darkweak/souin#840 fixes the underlying cause — responses carrying no surrogate-key header are currently all indexed under a single empty tag, which is what makes that index grow without bound.

The option has been parsed since the souin v1.7.7 bump but is absent from
the README, so it is effectively undiscoverable — in caddyserver#118 and caddyserver#127 it only
surfaced through maintainer comments.

It matters most on high-cardinality workloads, where maintaining the
surrogate index dominates the cost of a cache store, so document both what
it does and when reaching for it is worthwhile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant