Add weighted handler support to BatchQueue adaptive partitioning#13801
Merged
Add weighted handler support to BatchQueue adaptive partitioning#13801
Conversation
MAL metrics use weight 0.05 at L1 (vs 1.0 for OAL), reducing partition count and memory overhead when many MAL metric types are registered.
wankai123
approved these changes
Apr 7, 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.
Improve the performance of L1 BatchQueue partition scaling for MAL metrics
PartitionPolicy.resolve()now accepts a weighted handler count instead of raw handler count.BatchQueue.addHandler(type, handler, weight)overload allows callers to specify partition weight per handler type.L1 (MetricsAggregateWorker): MAL metrics use weight 0.05 (vs 1.0 for OAL). Rationale: MAL emits ~500 items/type per scrape interval. With 20,000-slot buffers, ~40 MAL types can safely share one partition (20,000 / 500 = 40). Weight 0.05 ≈ 1/20 gives 2x headroom.
L2 (MetricsPersistentMinWorker): No weight differentiation. After L1 pre-aggregation, both OAL and MAL have similar per-minute burst patterns.
Impact (8-core, 642 OAL + 1,247 MAL types):
CHANGESlog.