Repository navigation
perf(cache): read the immutable cache policy once per fingerprinter - #22
Merged
Merged
Conversation
immutable() re-read the environment and the build ID for every bundle in fingerprint() and for every freshness check, and the discovery manifest created a new fingerprinter per call. Memoize the policy per instance and document that immutable release snapshots should enable it to skip the per-request config and discovery scans.
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.
Finding
Review finding K-P2: mutable warm cache hits cost roughly six to eight filesystem calls per bundle (
stat()per bundlecomposer.jsonand per consumed config file,scandir()per existing config directory). The documented answer is the immutable policy with a build ID, butContainerResourceFingerprinter::immutable()re-read$_SERVER/$_ENV/getenv()and the build ID on every call: once per bundle insidefingerprint()and again in every freshness check.KernelPackageManifestCacheadditionally created a new fingerprinter per call.Change
docs/dependency-injection.mdnow state the per-request cost of mutable hits and recommendSYMPRESS_KERNEL_IMMUTABLE_CACHE=1with a build ID for immutable release snapshots.Verification
RuntimeCacheCompatibilityTest,CacheRequestCompatibilityTest,KernelPackageManifestCacheTest) pass;composer csandcomposer static-analysispass in a PHP 8.5.12 container.