[feat][ml] Configure and track named Pulsar allocators independently - #26597
Merged
merlimat merged 4 commits intoSep 15, 2026
Merged
Conversation
lhotari
requested review from
Technoboy-,
dao-jun,
david-streamlio,
merlimat and
nodece
September 15, 2026 15:53
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
force-pushed
the
lh-feat-named-bytebuf-allocators
branch
from
September 15, 2026 16:53
30782aa to
df6dc19
Compare
lhotari
marked this pull request as ready for review
September 15, 2026 16:54
Member
Author
|
/pulsarbot rerun |
merlimat
reviewed
Sep 15, 2026
Assisted-by: Codex
Assisted-by: Codex
merlimat
approved these changes
Sep 15, 2026
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
RangeEntryCacheImplkeeps a privateALLOCATORobtained throughPulsarByteBufAllocator.getOrCreate("ml-cache").pulsar.allocator.<id>.<setting>, thenpulsar.allocator.<setting>, then its built-in default. Supported settings aretype,exit_on_oom, andout_of_memory_policy.pulsar.allocator.default.*overrides for the default allocator. These overrides do not affect other identifiers. Settings are read when each allocator is first created.usedDirectMemory(); unavailable allocation counts report-1.pulsar.allocator.leak_detection; no per-allocator leak-detection setting is introduced.pulsar.allocator.pooledfallback 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:
Verifying this change
All 46 scoped tests and
quickCheckpassed locally: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: