Skip to content
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

c/leader_balancer: replaced muted group index with roaring bitmap #16917

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

mmaslankaprv
Copy link
Member

@mmaslankaprv mmaslankaprv commented Mar 6, 2024

The muted group index was using a absl::flat_has_set the use of flat data structure lead to oversized allocation when the number of muted/skipped raft group was large. Replaced a hash set with roaring bitmap. The roaring bitmap is efficient and compressed leading to better performance and smaller allocation.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x

Release Notes

Improvements

  • preventing large allocation in partition balancer code

The muted group index was using a `absl::flat_has_set` the use of flat
data structure lead to oversized allocation when the number of
muted/skipped raft group was large. Replaced a hash set with roaring
bitmap. The roaring bitmap is efficient and compressed leading to better
performance and smaller allocation.

Fixes: redpanda-data#12005

Signed-off-by: Michal Maslanka <michal@redpanda.com>
Copy link
Member

@StephanDollberg StephanDollberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes: #12005

I don't think that fixes that issue actually. The issue in that ticket stems from the random_reassignments constructor where we are constructing the _current_leaders hash map (which has a massive index array).

Our obvious easy fix is to switch it over to a btree map but I had a look at the leader balancer benchmarks and that tanks performance quite considerably (not super surprising).

Hence, we are currently looking in getting a segmented hashmap going that would be perfect for this usecase (and many others in RP). martinus/unordered_dense#112

Nevertheless this fix seems sensible either way so should be good to merge

@mmaslankaprv mmaslankaprv merged commit 1ed0e03 into redpanda-data:dev Mar 7, 2024
22 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

@vbotbuildovich
Copy link
Collaborator

/backport v23.2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants