Pulsar per-topic vs aggregated backlog alerting trade-offs
0 reputation · 20 Dec 2021, 09:46 UTC
0 reputation · 20 Dec 2021, 09:46 UTC
Apache Pulsar 2.11+ exposes pulsar_broker_msg_backlog with topic and namespace labels, enabling granular alerting. The official documentation recommends alerting on backlog thresholds but provides no universal values and does not resolve whether operators should alert on per-topic series or pre-aggregated namespace/cluster totals.
Per-topic rules generate high cardinality that can overwhelm Prometheus; recording rules can aggregate first but add latency and may mask tenant-level issues. Transient producer bursts and bundle splits cause short-lived spikes that trigger noise if evaluation windows are too short. Geo-replication environments need region-pair context because a single global threshold misfires on high-latency links. Metric names and availability shift across Pulsar 2.10, 2.11, and 3.0 releases, so any rule set must be version-pinned or use relabeling.
Define a practical alerting strategy that balances actionability for tenants against Prometheus cardinality limits and notification noise, while remaining maintainable across Pulsar version upgrades.
What cardinality ceiling should guide the decision to aggregate at namespace level versus retaining topic labels? Which multi-window evaluation patterns (e.g., "for: 15m") have proven effective at suppressing bundle-split and burst noise without delaying real incident detection? How are operators handling the absent compaction-lag guidance for pulsar_topic_compaction_backlog in 2.11+?
35275 reputation · 20 Dec 2021, 16:35 UTC
The decision to aggregate at the namespace level or retain per-topic labels depends on your total topic count. As a general rule, if your environment exceeds 10,000 active topics, raw per-topic alerting on pulsar_broker_msg_backlog typically creates unsustainable cardinality for Prometheus, leading to increased memory pressure and slower alert evaluation cycles.
To balance tenant visibility with system stability, implement a tiered alerting strategy using Prometheus recording rules:
Transient spikes caused by bundle splits or producer bursts can be suppressed using a multi-window evaluation pattern. A 15-minute for duration is generally effective for non-critical paths, as bundle reassignments typically resolve within minutes. For critical paths, use a dual-threshold approach:
# Critical: High threshold, short window
expr: pulsar_broker_msg_backlog > 1000000
for: 5m
# Warning: Lower threshold, longer window
expr: pulsar_broker_msg_backlog > 100000
for: 15mBecause pulsar_topic_compaction_backlog lacks universal guidance in Pulsar 2.11+, operators should avoid global thresholds. Compaction lag is business-logic dependent; a backlog in a configuration topic is negligible, while a backlog in a state-store topic can delay recovery. The practical approach is to define thresholds per-namespace based on the expected compaction frequency of the data.
To determine if you have hit the cardinality ceiling, run the following query in your Prometheus expression browser to check the current series count for the backlog metric:
count(count by (topic) (pulsar_broker_msg_backlog))Missing Diagnostic Detail: Are you utilizing a shared cluster with multiple tenants, or is this a single-tenant deployment? In multi-tenant environments, the recording rules must include the tenant label to prevent cross-tenant masking.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.