fix: cache strict-validation verdicts by config content#14253
Merged
chandler-solo merged 1 commit intoJun 15, 2026
Merged
Conversation
Performance fix; forward port of kgateway-dev#14242 Ref kgateway-dev#14184 Signed-off-by: David L. Chandler <[email protected]>
chandler-solo
force-pushed
the
chandler/forwardport14242caching
branch
from
June 15, 2026 15:14
c74218f to
b05c2bf
Compare
chandler-solo
enabled auto-merge
June 15, 2026 15:14
andy-fong
approved these changes
Jun 15, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves strict validation performance by adding a content-hash keyed caching validator and wiring it into setup and settings, reducing redundant Envoy validation invocations.
Changes:
- Add
cachingValidator(LRU + singleflight) and a factory to select validator mode from settings. - Introduce settings/env vars for validator mode and cache size; update setup wiring to use the factory.
- Add unit tests and benchmarks to validate caching behavior and measure overhead.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/validator/cache.go | Implements LRU + singleflight caching validator keyed by bootstrap content hash. |
| pkg/validator/cache_test.go | Adds tests for cache hits/misses, eviction, transient errors, and concurrency collapse. |
| pkg/validator/validator.go | Adds cacheKeyFor hashing helper used by caching validator. |
| pkg/validator/factory.go | Adds settings-based validator constructor selecting CACHE vs BINARY behavior. |
| pkg/validator/factory_test.go | Tests validator factory behavior across modes and defaults. |
| pkg/validator/validator_bench_test.go | Adds microbenchmarks to compare binary vs cached mode overhead. |
| api/settings/settings.go | Adds ValidatorMode and ValidatorCacheSize settings and decoding. |
| api/settings/settings_test.go | Extends settings tests to cover new env vars and validation. |
| pkg/kgateway/setup/setup.go | Switches setup to build validator via settings-driven factory. |
| pkg/kgateway/translator/irtranslator/validate.go | Optimizes strict route validation to 1 call for valid routes, 2 for invalid. |
| pkg/kgateway/translator/irtranslator/validate_test.go | Adds tests ensuring updated strict validation call behavior and error attribution. |
| pkg/kgateway/translator/irtranslator/backend_validation_test.go | Adds tests asserting strict validation caching across backend translations. |
| pkg/kgateway/proxy_syncer/perclient_bench_test.go | Adds per-client connect/drain benchmark comparing cached vs uncached validation. |
| go.mod | Promotes golang-lru/v2 to a direct dependency. |
| hack/utils/oss_compliance/osa_included.md | Records new direct dependency for OSS compliance. |
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.
Description
Performance fix; forward port of #14242
Ref #14184
Change Type
/kind fix
Changelog
Additional Notes