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][txn] Improve Reader in TransactionBuffer to reduce GC pressure #23779

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

dao-jun
Copy link
Member

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

Motivation

Make the reader referenced by TransactionBuffer 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 TopicTransactionBuffer 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

@dao-jun dao-jun added this to the 4.1.0 milestone Dec 25, 2024
@dao-jun dao-jun self-assigned this Dec 25, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 25, 2024
@dao-jun dao-jun changed the title [broker][txn][improve] Improve Reader in TransactionBuffer to reduce GC pressure [improve][txn][broker] Improve Reader in TransactionBuffer to reduce GC pressure Dec 25, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 25, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.12%. Comparing base (bbc6224) to head (52ffe82).
Report is 815 commits behind head on master.

Files with missing lines Patch % Lines
...r/impl/SnapshotSegmentAbortedTxnProcessorImpl.java 80.00% 0 Missing and 1 partial ⚠️
...lsar/broker/transaction/buffer/impl/TableView.java 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23779      +/-   ##
============================================
+ Coverage     73.57%   74.12%   +0.54%     
+ Complexity    32624    32125     -499     
============================================
  Files          1877     1853      -24     
  Lines        139502   143379    +3877     
  Branches      15299    16276     +977     
============================================
+ Hits         102638   106274    +3636     
+ Misses        28908    28721     -187     
- Partials       7956     8384     +428     
Flag Coverage Δ
inttests 26.71% <9.09%> (+2.13%) ⬆️
systests 23.12% <0.00%> (-1.21%) ⬇️
unittests 73.65% <81.81%> (+0.80%) ⬆️

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

Files with missing lines Coverage Δ
...ransactionBufferSnapshotBaseSystemTopicClient.java 78.20% <100.00%> (+1.88%) ⬆️
...r/impl/SnapshotSegmentAbortedTxnProcessorImpl.java 81.76% <80.00%> (+3.25%) ⬆️
...lsar/broker/transaction/buffer/impl/TableView.java 75.00% <80.00%> (ø)

... and 1016 files with indirect coverage changes

@lhotari lhotari changed the title [improve][txn][broker] Improve Reader in TransactionBuffer to reduce GC pressure [improve][txn] Improve Reader in TransactionBuffer to reduce GC pressure Jan 3, 2025
@lhotari lhotari merged commit 4a93e25 into apache:master Jan 3, 2025
58 of 60 checks passed
lhotari pushed a commit that referenced this pull request Jan 3, 2025
@dao-jun dao-jun deleted the dev/optimize_txn_buffer_reader branch January 5, 2025 07:15
poorbarcode pushed a commit to poorbarcode/pulsar that referenced this pull request Jan 23, 2025
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.

3 participants