Skip to content

Conversation

@dao-jun
Copy link
Member

@dao-jun dao-jun commented Apr 23, 2024

Motivation

In #19035 we introduced skipCondition to filter-out delay delivery messages before read entries from Bookkeeper, and in #21739, we also filter-out deleted(individual acked messages) before read entries.

However, it will lead to one situation: one single segment can be spit into segments. For example:
entries to be filter-out: [3, 5, 7]
entries to read: [1, 10]
then, it will be split into: [[1,2],[4], [6], [8,10]].

In the current implementation, after read [1,2] finished, then begin to read [4], after read [4] finished, then start to read [6]...
It will lead to latency increasing, memory(allocated for entries) will also be retained for a longer period of time, and affect the throughput of the system.

Modifications

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/ML category/performance Performance issues fix or improvements labels Apr 23, 2024
@dao-jun dao-jun added this to the 3.3.0 milestone Apr 23, 2024
@dao-jun dao-jun self-assigned this Apr 23, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 23, 2024
@dao-jun dao-jun changed the title [improve][ml] Make ManagedLedger read entries parallel [improve][ml] Optimize read entries with skiCondition Apr 24, 2024
@dao-jun dao-jun changed the title [improve][ml] Optimize read entries with skiCondition [improve][ml] Optimize read entries with skipCondition Apr 25, 2024
@dao-jun dao-jun marked this pull request as ready for review April 25, 2024 08:18
@dao-jun dao-jun closed this Apr 25, 2024
@dao-jun dao-jun reopened this Apr 25, 2024
@dao-jun dao-jun closed this May 26, 2025
@dao-jun dao-jun reopened this May 26, 2025
@dao-jun dao-jun requested a review from lhotari June 3, 2025 03:28
@lhotari
Copy link
Member

lhotari commented Jun 3, 2025

@dao-jun This PR will be a good foundation to switching to use BookKeeper's BP-62 Batch Read API (introduced in BK 4.17.0) in Pulsar. One of the gotchas of BP-62 is that a batch read might not return all entries even if there are remaining entries to be read. It seems that it would play nicely with the changes that are made in this PR so that the next read could continue to retry and read more. Would you be interested in implementing BP-62 support in Pulsar after this current PR has been merged?

@dao-jun
Copy link
Member Author

dao-jun commented Jun 11, 2025

@dao-jun This PR will be a good foundation to switching to use BookKeeper's BP-62 Batch Read API (introduced in BK 4.17.0) in Pulsar. One of the gotchas of BP-62 is that a batch read might not return all entries even if there are remaining entries to be read. It seems that it would play nicely with the changes that are made in this PR so that the next read could continue to retry and read more. Would you be interested in implementing BP-62 support in Pulsar after this current PR has been merged?

@lhotari Yes, I'd like to handle the case. And I created a PR to support Bookie batch read about a year ago, it's not finished yet. dao-jun#13

@dao-jun dao-jun requested a review from lhotari June 11, 2025 14:47
@lhotari
Copy link
Member

lhotari commented Sep 23, 2025

@dao-jun Please rebase once again

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

Labels

area/ML category/performance Performance issues fix or improvements doc-not-needed Your PR changes do not impact docs ready-to-test release/4.0.9 release/4.1.3 triage/lhotari/important lhotari's triaging label for important issues or PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants