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

Optimize concurrent collection's shrink logic #16754

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

wenbingshen
Copy link
Member

Motivation

Optimize concurrent collection's shrink and clear logic.

This PR was releated to bookkeeper's PR:apache/bookkeeper#3417

Modifications

  1. Reduce the repeated Arrays.fill in the clear process
  2. When capacity is already equal to initCapacity,rehash should not be executed
  3. Reduce the rehash logic in the clear process
  4. Shrinking must at least ensure initCapacity, so as to avoid frequent shrinking and expansion near initCapacity, frequent shrinking and expansion, additionally opened arrays will consume more memory and affect GC.

Documentation

Need to update docs?

  • doc-not-needed

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jul 23, 2022
@wenbingshen wenbingshen changed the title Optimize map shrink Optimize concurrent collection's shrink logic Jul 23, 2022
@codelipenghui codelipenghui added this to the 2.11.0 milestone Jul 25, 2022
@codelipenghui codelipenghui added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages area/broker labels Jul 25, 2022
@wenbingshen
Copy link
Member Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.12.0 Jul 26, 2022
@Technoboy- Technoboy- merged commit 00a0bcf into apache:master Jul 26, 2022
@wenbingshen wenbingshen deleted the OptimizeMapShrink branch February 15, 2023 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker doc-not-needed Your PR changes do not impact docs type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants