Repository navigation
Skip redundant cache entry access writes on cache hits - #10618
Draft
tobias-tengler wants to merge 1 commit into
Draft
tobias-tengler wants to merge 1 commit into
tobias-tengler wants to merge 1 commit into
Conversation
Contributor
Patch coverage85.0% of changed lines covered (17/20)
Uncovered changed lines (JSON){
"sha": "819dbaac7b5ada2277cb1af1aa849d7e9ce64548",
"files": [
{ "path": "src/HotChocolate/Caching/src/Caching.Memory/Cache\u00602.cs", "ranges": [[299, 301]] }
]
}Project coverage: 59.3% (315102/531566 lines) |
This was referenced Oct 19, 2026
Cache hits read the CLOCK access flag before writing it, so hot document and plan cache entries are no longer written from every core on every request.
michaelstaib
force-pushed
the
tte/cache-hit-access-flag
branch
from
October 22, 2026 23:08
52fe65b to
c653bb9
Compare
This branch has not been deployed
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.
Every hit in
Cache<TValue>andCache<TKey, TValue>writes the CLOCK access flag of the entry, even when the flag is already set. The document and operation plan caches are hit several times per request, so every core keeps writing to the same hot entries.This PR reads the flag first and writes it only when it was cleared by the eviction sweep, so hits on an already marked entry no longer write to shared memory. Eviction behavior is unchanged.
mainFour threads hit the same entry of a
Cache<string>.