⚡ perf(oci): replace Moka membership cache#220
Open
gaborbernat wants to merge 1 commit into
Open
Conversation
Merging this PR will degrade performance by 13.28%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
a9fb29c to
86b82a2
Compare
86b82a2 to
89f771a
Compare
We measured a 7.9x slowdown after adding Moka to repository-scoped blob reads in PR tox-dev#211. Use a bounded `parking_lot` read lock and hash set for one lookup per hit; recheck misses under the write lock so concurrent reads cannot count a key twice. Keep redb authoritative on misses. Hold the write lock through persistent invalidation so clients cannot read a deleted link from the cache.
89f771a to
043a328
Compare
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.
We added repository-scoped blob authorization in PR #211. We measured
oci_blob_servewith CodSpeed simulation at 87.6 µs on its parent and 694.7 µs at commit45f0155. We recorded the regression in #219.We replace Moka with a
parking_lotread lock and a hash set, giving cache hits one lock and one lookup. We store oneArc<str>in both the set and FIFO under an 8 MiB encoded-key cap and recheck misses under the write lock; concurrent readers cannot count a key twice.We use redb for misses and hold the write lock through persistent invalidation so a client reading during deletion cannot restore a deleted membership. We preserve repository isolation and shared blob storage from #211; operators do not need to change configuration or data.