GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [feat][ml] Configure and track named Pulsar allocators independently by lhotari · Pull Request #26597 · apache/pulsar

Conversation

@lhotari

@lhotari lhotari commented Sep 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Builds on #26595, which has merged. This branch has been rebased onto master; the diff now contains only the named-allocator changes.

Motivation

The managed-ledger entry cache needs its own allocator to retain separate allocation statistics, while benefiting from Pulsar's configurable allocator implementation and OOM handling. This also allows cache copies to use the adaptive allocator introduced in #26595. Efficient cache-owned copies are relevant to the BP-62 batch-read work in #25280, where retaining individual entries can retain larger backing buffers.

Modifications

  • Introduce a registry that atomically creates one allocator per identifier. RangeEntryCacheImpl keeps a private ALLOCATOR obtained through PulsarByteBufAllocator.getOrCreate("ml-cache").
  • Resolve each setting from pulsar.allocator.<id>.<setting>, then pulsar.allocator.<setting>, then its built-in default. Supported settings are type, exit_on_oom, and out_of_memory_policy.
  • Support pulsar.allocator.default.* overrides for the default allocator. These overrides do not affect other identifiers. Settings are read when each allocator is first created.
  • Preserve separate cache metrics. Generalize the allocation-statistics snapshot for pooled, unpooled, and adaptive allocators, and resolve broker allocator stats through the registry without creating unknown allocators. Adaptive used-memory statistics report usedDirectMemory(); unavailable allocation counts report -1.
  • Use Netty's global leak-detection level. Remove support for pulsar.allocator.leak_detection; no per-allocator leak-detection setting is introduced.
  • Document named configuration and retain the deprecated pulsar.allocator.pooled fallback introduced in [feat][misc] Support AdaptiveByteBufAllocator with configurable allocator type and metrics #26595.

For example, keep general allocation pooled while enabling adaptive allocation for cache copies:

-Dpulsar.allocator.type=pooled -Dpulsar.allocator.ml-cache.type=adaptive

Verifying this change

  • Make sure that the change passes the CI checks.

All 46 scoped tests and quickCheck passed locally:

./gradlew :pulsar-common:test --tests 'org.apache.pulsar.common.allocator.*' \
  :managed-ledger:test --tests 'org.apache.bookkeeper.mledger.impl.cache.RangeEntryCacheImplTest' \
  :pulsar-broker:test --tests 'org.apache.pulsar.broker.stats.AllocatorStatsGeneratorTest' \
  --tests 'org.apache.pulsar.broker.stats.OpenTelemetryManagedLedgerCacheStatsTest' quickCheck

Tests cover concurrent registration, independent heap/direct metrics for all three allocator types, property inheritance and overrides, OOM policies, global leak detection, cache copy ownership, and broker metrics. Shell syntax and whitespace checks also passed.

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

  • Dependencies (add or upgrade a dependency)
  • The public API — adds registry APIs, makes the cache allocator private, moves/generalizes the allocation-statistics helper, and removes the Pulsar leak-detection property constant.
  • The schema
  • The default values of configurations — named cache allocation uses the selected allocator's standard defaults instead of custom zero heap arenas and caching for all threads; leak detection follows Netty's global setting.
  • The threading model
  • The binary protocol
  • The REST endpoints — allocator stats look up registered identifiers, retaining the response schema.
  • The admin CLI options
  • The metrics — retain separate cache statistics and support the selected allocator implementation.
  • Anything that affects deployment — adds named allocator settings and changes leak-detection configuration to Netty's global property.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lhotari
lhotari requested review from Technoboy-, dao-jun, david-streamlio, merlimat and nodece September 15, 2026 15:53
@lhotari
[feat][ml] Configure and track named Pulsar allocators independently
df6dc19
Register one allocator per identifier with atomic get-or-create. Named type and OOM settings override unqualified defaults, including overrides for the default allocator. Use Netty global leak detection instead of Pulsar allocator leak settings.

Give the entry cache a private ml-cache allocator from the registry and restore its separate pool metrics. Resolve allocator stats through the registry and share a metric snapshot implementation across JVM and cache reporting for pooled, unpooled, and adaptive allocation.

Validation: 46 scoped allocator, cache, and broker metrics tests; quickCheck; shell syntax checks.

Assisted-by: Codex
@lhotari
lhotari force-pushed the lh-feat-named-bytebuf-allocators branch from 30782aa to df6dc19 Compare September 15, 2026 16:53
@lhotari
lhotari marked this pull request as ready for review September 15, 2026 16:54
@lhotari

lhotari commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

/pulsarbot rerun

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

merlimat
merlimat reviewed Sep 15, 2026
View reviewed changes
Comment thread managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

lhotari added 3 commits September 15, 2026 23:20
@lhotari
Use shared constants for registered allocator names
30502fe
Assisted-by: Codex
@lhotari
Merge remote-tracking branch 'origin/master' into lh-feat-named-byteb…
66b47f3
…uf-allocators
@lhotari
Wrap allocator constant references to satisfy checkstyle
92da74e
Assisted-by: Codex
@lhotari
lhotari requested a review from merlimat September 15, 2026 20:24
merlimat
merlimat approved these changes Sep 15, 2026
View reviewed changes
@merlimat
merlimat merged commit ca58c20 into apache:master Sep 15, 2026
43 checks passed

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 16, 2026
[improve][ml] Use adaptive allocation for managed ledger cache copies lhotari/pulsar#276
Closed
[improve][ml] Use adaptive allocation for managed ledger cache copies #26603
Merged
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request Sep 20, 2026
@lhotari @dao-jun
[feat][ml] Configure and track named Pulsar allocators independently (a…
9a23f4b
…pache#26597)

(cherry picked from commit ca58c20)
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request Sep 20, 2026
@lhotari @dao-jun
[feat][ml] Configure and track named Pulsar allocators independently (a…
857bd8e
…pache#26597)

(cherry picked from commit ca58c20)
dao-jun pushed a commit to ascentstream/pulsar that referenced this pull request Sep 20, 2026
@lhotari @dao-jun
[feat][ml] Configure and track named Pulsar allocators independently (a…
d96a0c3
…pache#26597)

(cherry picked from commit ca58c20)
@lhotari lhotari added this to the 5.0.0 milestone Oct 1, 2026
@dao-jun dao-jun mentioned this pull request Oct 4, 2026
[feat][ml] Port batch read and managed-ledger cache improvements (PIP-430) on BK 4.17.4.1 ascentstream/pulsar#105
Closed
Radiancebobo pushed a commit to Radiancebobo/pulsar that referenced this pull request Oct 8, 2026
@lhotari hechengbo
[feat][ml] Configure and track named Pulsar allocators independently (a…
8566452
…pache#26597)
@nodece nodece mentioned this pull request Oct 13, 2026
[feat][ml] Port batch read and managed-ledger cache improvements (PIP-430) on BK 4.17.4.1 (ml-only subset) ascentstream/pulsar#106
Closed
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Oct 13, 2026
@lhotari @nodece
[feat][ml] Configure and track named Pulsar allocators independently (a…
2f4ef5f
…pache#26597)

(cherry picked from commit ca58c20)
(cherry picked from commit d96a0c3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merlimat merlimat merlimat approved these changes
@nodece nodece Awaiting requested review from nodece
@dao-jun dao-jun Awaiting requested review from dao-jun
@Technoboy- Technoboy- Awaiting requested review from Technoboy-
@david-streamlio david-streamlio Awaiting requested review from david-streamlio

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

5.0.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@lhotari @merlimat
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.