Skip to main content
InterviewHubPRO
Section Overview
Q43

Question 43 of 50

Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

86%
Apache Kafka Streaming (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)

Consumer Lag Monitoring and Mitigation: Prometheus JMX exporter, Burrow, and scaling partition-to-consumer mapping.

senior LevelSystem Design

In Simple Words: Consumer Lag is the delta between the latest offset written to a partition (Log End Offset) and the latest offset committed by a consumer group:

  • Monitoring Tools: Export metrics via Kafka Exporter or Burrow (kafka_consumergroup_lag).
  • Mitigation Strategies:
    1. If lag is isolated to one partition -> Check for hot key skew.
    2. If lag is spread across all partitions and consumer CPU is 100% -> Increase partition count and add more consumer instances up to total partition count.
    3. If consumer thread is blocked on slow external database calls -> Decouple consumption from processing using an internal in-memory worker thread pool.