Skip to content

Add weighted handler support to BatchQueue adaptive partitioning#13801

Merged
wu-sheng merged 1 commit intomasterfrom
feature/batch-queue-weighted-partitions
Apr 7, 2026
Merged

Add weighted handler support to BatchQueue adaptive partitioning#13801
wu-sheng merged 1 commit intomasterfrom
feature/batch-queue-weighted-partitions

Conversation

@wu-sheng
Copy link
Copy Markdown
Member

@wu-sheng wu-sheng commented Apr 7, 2026

Improve the performance of L1 BatchQueue partition scaling for MAL metrics

  • The benchmark result.

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):

L1 Before L1 After Reduction
Partitions 1,045 452 57%
Array overhead 167 MB 72 MB 57%
  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.

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.
@wu-sheng wu-sheng added backend OAP backend related. enhancement Enhancement on performance or codes labels Apr 7, 2026
@wu-sheng wu-sheng added this to the 10.5.0 milestone Apr 7, 2026
@wu-sheng wu-sheng requested a review from wankai123 April 7, 2026 01:00
@wu-sheng wu-sheng merged commit ebda65c into master Apr 7, 2026
212 checks passed
@wu-sheng wu-sheng deleted the feature/batch-queue-weighted-partitions branch April 7, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend OAP backend related. enhancement Enhancement on performance or codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants