Integration / Apache Kafka Interview questions
How do you troubleshoot consumer lag in a Kafka application?
Consumer lag — the gap between the latest offset produced to a partition and the offset a consumer group has actually processed — is the standard signal that a consumer group isn't keeping up, and the troubleshooting path starts with measuring it precisely before guessing at a cause.
kafka-consumer-groups.sh --describe --group order-processors --bootstrap-server localhost:9092
- Check if lag is growing or just non-zero — some lag is normal under bursty load; steadily increasing lag over time is the real signal of a problem.
- Check per-partition lag, not just the group total — lag concentrated on one or two partitions usually points to a hot key or uneven partition assignment, not a group-wide capacity problem.
- Check processing time per record — slow downstream calls (a database write, an external API) inside the consumer loop are a very common root cause.
- Check consumer count versus partition count — if the group already has as many consumers as partitions and is still falling behind, only adding more partitions and consumers together will actually add parallelism.
- Check for frequent rebalances — a group that keeps rebalancing spends time reassigning partitions instead of processing, which itself can look like lag.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
