docs: document disable_surrogate_key - #141
Open
rhurling wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR and all of the following text is written by Claude, after debugging a production incident as mentioned.
disable_surrogate_keyhas been parsed since the souin v1.7.7 bump (configuration.go→cfg.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.