[Cache] Improve the performance of tag invalidation #44233
Closed
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 is a follow-up to #44015.
The change of tag invalidation algorithm has impact on performance because of possible mutual overwrites of tags and calculated values. The degree of impact mainly depends on the number of concurrent processes which access the same keys so the issue is greatly mitigated by
LockRegistry
inget()
and the cache of known tag versions but in case of plain PSR-6 operations, the rate of writes may increase many times.The main purpose of changeing the algorithm was prevention of tag invalidation losses, and it do its job flawlessly, but for the sake of performance I think we should consider the hybrid algorithm: update tag versions if possible or delete them if the pool rejects updates. It looks like a good compromise to me.