-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement lock striping for cmap #1053
Conversation
This change introduces lock striping to improve concurrent map performance by reducing lock contention. Instead of using a single lock for the entire map, the implementation divides the map into shards, each with its own lock, allowing for better parallelism and throughput in concurrent operations.
WalkthroughThe changes in this pull request significantly modify the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Map
participant Shard
Client->>Map: Set(key, value)
Map->>Shard: shardForKey(key)
Shard->>Shard: Lock()
Shard->>Shard: Store value
Shard->>Map: Unlock()
Map->>Client: Acknowledge
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1053 +/- ##
==========================================
+ Coverage 46.66% 46.76% +0.09%
==========================================
Files 82 82
Lines 11959 12001 +42
==========================================
+ Hits 5581 5612 +31
- Misses 5816 5826 +10
- Partials 562 563 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- pkg/cmap/cmap.go (2 hunks)
🧰 Additional context used
🪛 golangci-lint
pkg/cmap/cmap.go
[high] 60-60: G115: integer overflow conversion int -> uint32
(gosec)
What this PR does / why we need it:
Implement lock striping for cmap
This change introduces lock striping to improve concurrent map performance by
reducing lock contention. Instead of using a single lock for the entire map,
the implementation divides the map into shards, each with its own lock,
allowing for better parallelism and throughput in concurrent operations.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation:
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes
Documentation