44 min read

Kafka Broker Monitoring: Diagnose CDC Pipeline Health

Use Kafka broker metrics to rule the cluster in or out, then check consumer lag and connector metrics in order to diagnose why a CDC pipeline falls behind.

Kafka Broker Monitoring: Diagnose CDC Pipeline Health

Direct Answer

Kafka broker monitoring is one layer of CDC pipeline diagnosis, not a substitute for it. Broker metrics tell you whether the cluster itself is healthy — replication, controller state, request-handler and network-thread headroom, request latency — but no single set of broker counters can identify an end-to-end root cause on its own. Broker metrics answer "is the cluster keeping up?"; consumer group metrics answer "is the consumer keeping up?"; and source/connector metrics answer "is the database or connector delivering events?". Those three questions are asked at three different places, so a complete diagnosis walks the layers in order: use broker metrics to clear or convict the cluster, then test the consumer, then the source.

Author: jackey.ye · Last updated: 2026-12-03

Direct Answer

Why Broker Metrics, Consumer Lag, and Connector Metrics Are Different Signals

Broker metrics describe server-side capacity and replication state, not end-to-end pipeline progress. The Apache Kafka operations and monitoring reference is the canonical source for the broker metric list and its interpretation, and it is explicit that some commonly cited "lag" metrics are client-side. In particular, records-lag-max is published by the consumer, not the broker, and is computed from the consumer's current position rather than its committed offset — so it is not a broker health signal at all.

The three layers map to three distinct questions:

  • Broker layer (JMX on each broker): Is replication intact, is there exactly one active controller, and do request handlers and network processors have idle headroom?

  • Consumer layer (client JMX / group offsets): How far behind is the consumer group, measured as committed-offset lag (log end offset minus last committed offset), and is that lag growing, flat, or recovering?

  • Source/connector layer: Is the upstream database or connector actually producing changes at the expected rate, or has ingestion itself stalled?

Conflating these layers is the most common CDC misdiagnosis, and most of that confusion starts with the word "lag". Rising consumer lag only tells you that the group's committed offset is falling behind the partitions' log end offsets — that is, records have arrived in Kafka but the group has not committed past them yet. It is a Kafka offset backlog, produced by something between the broker and the consumer's commit. A source database that simply changes fewer rows than expected does not create that backlog; it creates the opposite symptom, where lag stays low and flat while the lakehouse quietly serves outdated records. The two symptoms need different evidence, and only a source-side check (binlog position, replication slot, connector poll counters) can tell them apart.

Where each layer's evidence actually lives

The practical consequence is that the three layers are collected from different endpoints and cannot be substituted for one another:

  • Broker metrics are exposed as JMX MBeans on each broker process (for example the kafka.server domain for replication and request handling). They are per-broker, so a cluster-wide view requires scraping every broker and aggregating.

  • Consumer metrics come from the client JVM's JMX (for a Java consumer) or from the group coordinator's stored offsets, read with kafka-consumer-groups --describe. The broker stores committed offsets but does not publish group lag as a broker health metric.

  • Source/connector metrics come from the connector runtime or the upstream database itself — binlog position, rows read per second, replication slot lag for PostgreSQL, or the connector's own task and error counters.

A monitoring stack that only scrapes broker JMX will show a perfectly healthy cluster while a CDC pipeline is hours behind, because the stall lives in a layer it never observes. Conversely, a stack that only watches consumer lag will page on a symptom whose root cause may sit in any of the layers above. Broker metrics earn their place because they are the cheapest way to rule the cluster in or out — they are a gate, not a verdict. Labeling each metric with its layer is what makes the numbered diagnosis in the next section mechanical rather than guesswork.

One more distinction matters here, because it changes which JMX beans you scrape. Up to Kafka 3.x, cluster metadata was managed by a ZooKeeper-backed controller and ActiveControllerCount was the usual check. On KRaft clusters — the default metadata mode in current releases — metadata is committed through a Raft quorum rather than a single elected controller. The monitoring reference splits this into two metric families: quorum metrics under kafka.server:type=raft-metrics (current state and current leader, current epoch, log end offset, average and maximum commit latency, and the Raft IO thread's poll idle ratio), and controller metrics under kafka.controller:type=KafkaController (fenced broker count, active broker count, event-queue times, last applied and last committed record offsets, and timed-out broker heartbeat count). Crucially, the reference notes the raft metrics "are reported on both Controllers and Brokers in a KRaft Cluster," so quorum state is observable from brokers too, and ActiveControllerCount is documented per node with valid values of 0 or 1. Fenced broker counts, broker heartbeats that timed out, and the controller's metadata-log offsets are Kafka-specific health signals with no ZooKeeper-era equivalent. If you carry a ZooKeeper checklist onto a KRaft cluster, you will watch the wrong beans.

Broker Metric Comparison Matrix

The table below maps the core metrics to what the Apache Kafka monitoring reference says about them, the failure pattern a deviation suggests, and the layer each belongs to. Two caveats before you copy any of it into an alert rule. First, the reference mostly describes qualitative expectations, not universal numbers — where it does give a figure, such as an "ideal" idle fraction, that is documented guidance for the cited version rather than a rule to alert on, and it is a starting hypothesis to validate against your own replication factor, retention policy, and traffic shape. Second, several of these signals are legitimately non-zero during planned work: ISR shrinks and leader elections are expected while a broker is restarted or partitions are reassigned, so a short, correlated burst is maintenance, while an uncorrelated or creeping one is instability.

Metric

Documented expectation

What a deviation suggests

Kafka layer

Primary diagnostic use

UnderReplicatedPartitions

0

Sustained non-zero = partitions below their replica set

Broker

Rule replication trouble in or out

OfflinePartitionsCount

0

Non-zero = partitions with no available leader; clients cannot produce or consume

Broker (controller view)

Detect hard availability loss

UnderMinIsrPartitionCount

0

Non-zero means the in-sync replica count has dropped below min.insync.replicas; produce acknowledgements may fail

Broker

Flag an actual durability breach during incidents

AtMinIsrPartitionCount

0

Non-zero means the in-sync replica count is exactly at min.insync.replicas, leaving no tolerance for one more replica loss

Broker

Catch partitions one replica loss away from a breach

IsrShrinksPerSec / IsrExpandsPerSec

0 apart from broker failure and restart

Shrinks without a matching restart or reassignment = flapping replicas

Broker

Separate maintenance from chronic instability

ActiveControllerCount

1 on exactly one node

0 or more than 1 = controller election problem

Broker (ZooKeeper mode) / KRaft controller

Confirm metadata layer has a leader

RequestHandlerAvgIdlePercent

The reference documents "between 0 and 1, ideally > 0.3" as guidance, not a universal threshold

Falling relative to your own baseline = handler saturation

Broker

Separate request pressure from storage and network

NetworkProcessorAvgIdlePercent

The reference documents "between 0 and 1, ideally > 0.3" as guidance, not a universal threshold

Falling relative to baseline = network-thread pressure

Broker

Identify network-bound brokers

LeaderCount

Mostly even across brokers

Skew beyond your normal balance = leadership concentration

Broker

Spot hot brokers after maintenance or reassignment

TotalTimeMs (queue, local, remote, response)

Stable, low queue segment

Queue segment rising while local time stays flat = saturation, not slow disk

Broker

Isolate queueing from storage and network

BytesInPerSec / BytesOutPerSec

Consistent with expected ingress and egress

Large gap between the two for one topic = producer/consumer imbalance

Broker

Correlate write rate with fetch rate

KRaft raft-metrics current state, commit latency

One leader; followers stable; commit latency steady

Persistent candidate state or rising commit latency = quorum trouble

KRaft quorum

Confirm metadata quorum health

TimedOutBrokerHeartbeatCount, FencedBrokerCount

No growth in steady state

Growth = brokers losing contact with the controller

KRaft controller

Catch broker eviction early

Committed-offset lag (log end offset minus committed offset)

Stable and bounded for your SLO

Monotonic growth = Kafka-side offset backlog the group is not clearing

Consumer

Measure the real group backlog

records-lag-max

Not a group total

Consumer-published from current position, not committed offset

Consumer

Per-partition view only; never a cluster signal

Two rows deserve emphasis because they are misread most often. records-lag-max is defined in the monitoring reference as a consumer-side metric based on the consumer's current offset rather than its committed offset, so it can look healthy while a group is silently failing to commit. And UnderReplicatedPartitions is not the same question as UnderMinIsrPartitionCount: the first counts partitions below their full replica set, the second counts partitions whose ISR has dropped strictly below min.insync.replicas. Note also the distinction the reference draws between the two min-ISR counters: UnderMinIsrPartitionCount is |ISR| < min.insync.replicas, while AtMinIsrPartitionCount is |ISR| = min.insync.replicas. The first is a breach already happening; the second is the margin down to zero, and conflating them hides the warning window.

Two internal guides cover the layers this table only summarizes. The Kafka consumer lag metrics guide separates records-lag, records-lag-max, committed-offset lag, and time lag, and explains why the Java client and the command line can disagree about the same group. For the upstream half, the MySQL CDC patterns comparison shows how binlog, trigger, and polling capture differ in what they emit — and therefore in what the connector layer can even report.

Numbered Diagnostic Steps for a CDC Pipeline

Work the layers in order. Each step either clears a layer or localizes the bottleneck before you move on.

  1. Confirm the metadata layer has a leader. On a KRaft cluster, check that the quorum reports a stable leader and that ActiveControllerCount is 1 on the active controller only; on a ZooKeeper-mode cluster, check the same metric across brokers. A missing leader or duplicate actives points at the cluster itself.

  2. Check availability. Read OfflinePartitionsCount and the controller's FencedBrokerCount. Non-zero offline partitions mean clients cannot produce or consume for those partitions; growing fenced brokers mean brokers are losing contact with the controller.

  3. Check replication, with context. Read UnderReplicatedPartitions, then both min-ISR counters: UnderMinIsrPartitionCount for partitions whose ISR is strictly below min.insync.replicas, and AtMinIsrPartitionCount for partitions sitting exactly at that floor with no remaining margin. Add IsrShrinksPerSec/IsrExpandsPerSec. Then overlay your maintenance calendar and reassignment activity: a burst that lines up with a broker restart or a partition reassignment is expected and should resolve itself, while a sustained or recurring ISR change with no matching operational event is instability worth chasing.

  4. Assess broker headroom against your own baseline. Inspect RequestHandlerAvgIdlePercent and NetworkProcessorAvgIdlePercent and compare them with what this cluster normally shows at a comparable hour. The monitoring reference documents "between 0 and 1, ideally > 0.3" as its own guidance rather than a value to alert on, so treat it as a hint about direction, not a decision line. A broker that normally sits at 0.6 and has dropped to 0.35 is already unhealthy for you, which is why the baseline beats any published figure.

  5. Decompose request latency. Split TotalTimeMs into queue, local, remote, and response segments. If the queue and wait segments rise while local (disk) time stays flat, you have request pressure; if local time rises too, look at storage.

  6. Check leadership balance and throughput. Review LeaderCount for post-maintenance skew, then compare BytesInPerSec with BytesOutPerSec per topic. Ingress far above egress is consistent with consumers not fetching, but it does not prove why.

  7. Now measure consumer lag. With the cluster cleared, compute committed-offset lag per partition and watch the trend. Growth here is a Kafka-side offset backlog — the consumer group is not committing past what has arrived — and the reasons range from rebalance churn to slow processing to a throttled fetch.

  8. Finish with the source and connector. Only if Kafka-side backlog is absent yet the lakehouse is stale should you go upstream: check the binlog position or replication slot advancing, the connector task state, source-record-poll-rate and source-record-write-rate in Connect, and error counters. Confirm the source is emitting the volume of changes you expect.

Reusable troubleshooting checklist

Run this checklist on every CDC lag incident and record the result per layer so the next incident starts from evidence rather than from scratch.

  • Scope the symptom: note the affected consumer group, topic, partitions, and the time the symptom started — and whether it is offset lag or stale data with no lag.

  • Metadata leader: KRaft quorum has a leader; ActiveControllerCount is 1 on exactly one node.

  • Availability: OfflinePartitionsCount and FencedBrokerCount are static or zero.

  • Replication, with context: UnderReplicatedPartitions is zero; UnderMinIsrPartitionCount (ISR strictly below min.insync.replicas) is zero; AtMinIsrPartitionCount (ISR exactly at the minimum) is zero or explained by a known restart or reassignment.

  • Headroom: idle percentages are at or above the cluster's own recent baseline for that hour.

  • Latency decomposition: TotalTimeMs queue segment is flat; if it is rising, check whether local (disk) time rose with it.

  • Balance: LeaderCount matches the cluster's usual distribution; no post-maintenance hot broker for the affected topic.

  • Throughput: BytesInPerSec and BytesOutPerSec for the topic track each other within your expected producer/consumer ratio.

  • Kafka-side backlog: committed-offset lag per partition recorded with its trend (growing, flat, recovering), not just an instantaneous value.

  • Consumer health: rebalance activity, poll interval, and per-record processing time compared against the group's observed throughput.

  • Source/connector: binlog or slot position advancing; connector task status running; source-record read and write rates and error counters matching expectation.

  • Freshness math: convert residual delay into time-to-freshness for the sink and compare against the pipeline's stated freshness target.

  • Record the verdict: state which layer was the bottleneck and which layers were explicitly cleared, so the next responder does not repeat the same checks.

Worked Example: Applying the Thresholds

This is an illustrative walkthrough built from the documented metric semantics, not a report from a specific production cluster. Read the numbers as relative to that broker's own baseline, not as universal thresholds.

A CDC pipeline from MySQL into a lakehouse shows committed-offset lag climbing steadily for one consumer group. Applying the steps:

  • Metadata and availability first: the KRaft quorum reports a stable leader, ActiveControllerCount is 1 on one controller, OfflinePartitionsCount is 0, and no brokers are fenced. The cluster is not partitioned or leaderless.

  • Replication: UnderReplicatedPartitions, UnderMinIsrPartitionCount, and AtMinIsrPartitionCount are all zero, and the ISR shrink counter has not moved since the last planned restart two weeks ago. Replication is not the story.

  • Headroom and latency: the affected brokers usually show request-handler idle around 0.45 at this hour; today it is 0.11. TotalTimeMs shows the queue segment rising while local (disk) read time is flat, and the network processor's idle fraction dropped in step with the handler figure.

  • Consumer: committed-offset lag is growing across all partitions of the topic, so the whole group is falling behind rather than one stuck partition.

  • Conclusion: this is request pressure at the broker, showing up downstream as offset backlog. Two brokers took on a disproportionate share of leadership after a recent reassignment (a LeaderCount skew), so the right first move is to rebalance leadership or add capacity — not to tune the consumer's poll settings, which would simply move the backlog.

Now flip one input. If the Kafka-side lag had been flat while the lakehouse served hour-old rows, steps 1–6 would all come back clean and the verdict would shift upstream: a paused connector task, a stalled replication slot, or a source table nobody is writing to. That is exactly the case broker metrics cannot see, and why the checklist ends at the connector rather than at the cluster.

Turning residual lag into a freshness number

Once the bottleneck layer is identified, the remaining question for a lakehouse operator is how much staleness the backlog represents. A rough conversion is lag in records divided by the sink's sustained processing rate, but that figure has to be reconciled with the sink's own scheduling granularity, which varies by implementation and configuration. In Singdata Lakehouse, for example, the streaming data pipeline overview documents a minimum supported scheduling interval of one minute for incremental processing, so on that configuration a backlog that clears in seconds at the broker and consumer layers can still present as up to a minute of extra table-level latency. That is a property of the sink's schedule, not a broker fault, and it belongs in the freshness budget rather than in the broker investigation — but check your own sink's cadence rather than assuming a one-minute floor. The data freshness SLA guide shows how to state that budget per layer and check it against source-event timestamps instead of a dashboard refresh stamp.

Worked Example: Applying the Thresholds

The Order That Prevents Wasted Work

The checklist above is the single canonical list — no second version here. What makes it reusable is the ordering, because the order is what stops you from fixing the wrong thing. Metadata and availability come first (ActiveControllerCount, quorum leader, OfflinePartitionsCount), then replication with maintenance context, then request-handler and network headroom against the cluster's own baseline, then the TotalTimeMs decomposition, then committed-offset lag, and only then source/connector throughput.

Two wrong turns are common. Starting from a lag number sends people into consumer tuning while a broker is queueing, or while a connector task has been stopped for an hour. Starting from the source sends people into database logs while a partition has no leader at all. Neither layer is "the" answer; each is a gate you pass or a gate you fail, and writing down which gate you cleared is what turns an incident into evidence for the next one.

Where the Lakehouse Side Fits

Treat the lakehouse sink as a separate timing domain: its scheduling cadence can dominate end-to-end freshness even when the broker and consumer layers are healthy. Singdata Lakehouse ingests Kafka and AutoMQ streams through its Pipe objects, supports database CDC for MySQL, PostgreSQL, and Oracle, and records table-level change data in Table Stream, which makes the sink side checkable on its own terms rather than through Kafka counters.

The practical implication for diagnosis is simple: actual sink scheduling intervals vary by implementation and configuration, so a sink with a coarse cadence will not show improvements finer than that cadence in end-to-end freshness even when brokers and consumers are healthy. End-to-end delay therefore has to be read against whatever scheduling model your specific sink uses. In Singdata Lakehouse's documented case, the minimum supported scheduling interval for incremental processing is currently one minute, but that is a configuration fact about one platform rather than a property of lakehouse sinks in general. The Pipe and change data capture overview covers the continuous-consumption path from Kafka and how Pipe objects report their state, and the data ingestion guide lays out the three ingest paths — database sync, file import, and message queue — with the connectors available for each. For how these pieces are wired without custom code, the Lakehouse Studio product page describes the integration modules; a broader comparison of batch and streaming architectures is in the Databricks vs Snowflake vs Singdata breakdown.

Separating sink cadence from broker and consumer delay

When you attribute end-to-end delay, decompose it rather than inferring it from a single residual. Small broker request time and a small committed-offset lag do not by themselves prove that the remaining delay is sink scheduling, and they do not rule out every broker or consumer problem either — request time and group lag are only two of many signals, so disk pressure, throttling, rebalance churn, or uneven partition assignment can still be present elsewhere in those layers. At most, healthy values on those two metrics reduce the likelihood that the cluster and the commit path are the dominant cost. The gap can equally come from source-side capture delay, connector poll and flush behavior, per-record processing or transformation in the sink writer, batching and commit intervals, network transfer between stages, or simply clock skew and measurement-point differences between dashboards.

So instrument timestamps at each stage — event time in the source, time entering Kafka, time committed by the consumer, time accepted by the sink, and time visible in the table — and compare consecutive pairs. Only a segment whose interval actually accounts for the observed delay should be named as the cause. Treat sink cadence as a hypothesis to confirm with a stage-level timestamp, not as the default explanation for whatever is left over, and keep the same layering discipline the broker checklist enforces as you extend it one hop downstream.

For a deeper treatment of the consumer-side measurement — including why records-lag-max is not a group-wide total and how committed-offset lag differs from time lag — the consumer lag metrics guide walks through read-only commands for each figure.

FAQ

Does Kafka broker monitoring show consumer lag?

Not directly. Broker-side monitoring covers replication, controller and quorum state, request-handler and network-thread headroom, and throughput. Lag is a consumer-group measure: committed offsets live in the internal __consumer_offsets topic, and records-lag-max is published by the consumer from its current position rather than its committed offset. Broker metrics clear or convict the cluster; lag has to be measured separately.

Why is my consumer lag growing if the brokers look healthy?

Because lag growth describes the Kafka side of the pipeline, and healthy brokers only rule out one cause. A growing committed-offset backlog usually means the group is not committing as fast as records arrive — slow per-record processing, repeated rebalances, a throttled fetch, or too few consumers for the partition count. Verify the lag trend and rebalance activity first, then check whether ingest rate itself rose.

What is a normal UnderReplicatedPartitions value?

The monitoring reference gives zero. Anything sustained above zero means some partitions have fewer in-sync replicas than they should. Short non-zero windows during a broker restart or partition reassignment are expected and should close on their own; persistent or recurring values with no matching operational event are the ones to investigate. For durability specifically, read the two min-ISR counters together: UnderMinIsrPartitionCount counts partitions with ISR strictly below min.insync.replicas, and AtMinIsrPartitionCount counts partitions sitting exactly at it.

How does controller monitoring differ on KRaft clusters?

On KRaft clusters metadata is committed through a Raft quorum rather than a single ZooKeeper-elected node, so you watch two families of metrics. Quorum metrics live under kafka.server:type=raft-metrics — current state and current leader, current epoch, log end offset, and average and maximum commit latency — and the reference says these "are reported on both Controllers and Brokers." Controller metrics live under kafka.controller:type=KafkaController, such as FencedBrokerCount, ActiveBrokerCount, and TimedOutBrokerHeartbeatCount. ActiveControllerCount is documented per node with valid values of 0 or 1, so you still expect exactly one node reporting 1, but it is no longer the whole metadata-health picture as it largely was in ZooKeeper mode.

Can a lakehouse sink's scheduling cause apparent lag?

Yes, in the sense of end-to-end freshness rather than Kafka offset lag. Actual sink scheduling intervals vary by implementation and configuration, and a sink only reveals improvements down to its own cadence, so a coarse schedule can mask a healthy broker and consumer layer. Singdata Lakehouse documents a one-minute minimum supported interval for incremental processing, but that is one platform's configuration, not a universal floor. Interpret end-to-end delay against your sink's scheduling model before attributing it to Kafka, and measure freshness from source-event timestamps per the data freshness SLA guide.

References

Next Step

Build one dashboard with three panels — broker and KRaft quorum health, committed-offset lag trend, and source/connector throughput — and put the cluster baseline next to the request-handler and network idle figures so a drop is visible as a delta rather than against a stock number. When an alert fires, run the eight steps in order and record which layer you cleared; the next incident will start from that record instead of from the alarm text.


Disclosure: This article is published on Singdata Trending. Product capabilities described are limited to documented, verifiable functionality; no performance figures, prices, or guarantees are implied.

Related Articles