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

[improve][broker] Improve SystemTopicBasedTopicPoliciesService reader to reduce GC pressure #23780

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dao-jun
Copy link
Member

@dao-jun dao-jun commented Dec 25, 2024

Motivation

Make the reader referenced by SystemTopicBasedTopicPoliciesService pooling messages to reduce GC pressure.

If poolMessage=false of the Reader, pulsar client will copy message payload into heap without pooling.
Generally, it is not recommended to users use the feature, because it requires call message.release() manually, or it will lead to mem leak.

However, in the broker side, we need this feature to improve JVM GC performance.
Especially for there is a big number of topics served by a single broker.

Modifications

  1. Make poolMessage=true when SystemTopicBasedTopicPoliciesService component creating a reader
  2. Call message.release() manually after process messages.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@dao-jun dao-jun added area/broker ready-to-test category/performance Performance issues fix or improvements labels Dec 25, 2024
@dao-jun dao-jun self-assigned this Dec 25, 2024
@dao-jun dao-jun added this to the 4.1.0 milestone Dec 25, 2024
Copy link

@dao-jun Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Dec 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.10%. Comparing base (bbc6224) to head (850df7b).
Report is 815 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23780      +/-   ##
============================================
+ Coverage     73.57%   74.10%   +0.53%     
+ Complexity    32624    31729     -895     
============================================
  Files          1877     1853      -24     
  Lines        139502   143377    +3875     
  Branches      15299    16276     +977     
============================================
+ Hits         102638   106254    +3616     
+ Misses        28908    28735     -173     
- Partials       7956     8388     +432     
Flag Coverage Δ
inttests 26.70% <100.00%> (+2.11%) ⬆️
systests 23.21% <66.66%> (-1.11%) ⬇️
unittests 73.62% <100.00%> (+0.77%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../service/SystemTopicBasedTopicPoliciesService.java 75.57% <100.00%> (+1.37%) ⬆️
...roker/systopic/TopicPoliciesSystemTopicClient.java 72.83% <100.00%> (+0.68%) ⬆️

... and 1018 files with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker category/performance Performance issues fix or improvements doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants