Lag — the count of unprocessed messages in a partition. Diagnose: kafka-consumer-groups.sh --describe. Four causes: (1) consumer is too slow (CPU/DB bottleneck), (2) fewer partitions than consumers in the group (idle consumers), (3) max.poll.interval.ms < processing time (rebalance loop), (4) slow downstream (DB, external API). Fixes: scale up partitions, parallelize, tune max.poll.records.
Below: details, example, related terms, FAQ.
Free online tool — health checker: instant results, no signup.
# Diagnose lag
$ kafka-consumer-groups.sh --bootstrap-server localhost:9092 \
--group my-consumer --describe
GROUP TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG
my-consumer orders 0 10000 15000 5000
# Increase partitions (non-reversible)
$ kafka-topics.sh --alter --topic orders --partitions 12Kafka consumer lag is a critical metric that indicates how far behind a consumer is in processing messages. It's essential to monitor this lag to ensure that your application remains responsive and efficient. The lag is defined as the difference between the last produced message offset and the last committed offset of the consumer group.
To effectively monitor consumer lag, you can use the kafka-consumer-groups.sh script. This tool provides insights into the consumer group status, including the current lag for each partition. The command to check the consumer group details is as follows:
kafka-consumer-groups.sh --bootstrap-server --describe --group In the output, look for the Lag column to identify how many messages are unprocessed for each partition. Regularly checking this metric can help you identify trends and take proactive measures to mitigate lag before it affects your application.
Additionally, consider integrating monitoring solutions such as Prometheus and Grafana to visualize consumer lag metrics over time. This can help in spotting potential issues before they escalate into significant bottlenecks.
Optimizing your Kafka consumer configuration is crucial for minimizing consumer lag. Below are some key configurations that can significantly impact consumer performance:
poll(). A higher value allows for batch processing of messages, which can improve throughput. Example:max.poll.records=500fetch.min.bytes=1024session.timeout.ms=30000By carefully tuning these parameters, you can enhance the performance of your Kafka consumers, thereby reducing consumer lag and improving overall system efficiency.
When dealing with Kafka consumer lag, it’s essential to follow a systematic troubleshooting approach to identify and resolve underlying issues. Here are common steps to consider:
kafka-consumer-groups.sh command to monitor the lag and status of your consumer groups. This will help you identify which consumers are lagging and by how much.top or htop to monitor resource consumption on consumer instances.kafka-topics.sh command to check the number of partitions and their distribution across consumers.max.poll.interval.ms and max.poll.records. Adjust these settings based on the processing time of your application.By following these troubleshooting steps, you can systematically identify and address issues causing consumer lag, ensuring that your Kafka consumers operate efficiently.
Health Score is a comprehensive assessment of site technical health across 20+ parameters: SSL, security headers, response speed, SEO technical factors, and availability.
20+ parameters in one number: SSL, headers, speed, SEO technical factors.
Each parameter with explanation — what is checked, what was found, how to fix.
Compare Health Score at different dates — see progress or regression.
Set up automated Health Score checks and get notified when the score drops.
quick pre-release audit
technical baseline score
client site check
header security audit
Health Score check history and real-time site health monitoring.
Sign up freeRule of thumb: 10× expected throughput in MBps. 1 partition = ~10 MB/s. 100 MB/s throughput → 10+ partitions.
No, it's non-reversible. Create a new topic with fewer, switch producers, migrate consumers.
Retention: deletes by time (7 days default). Compaction: keeps the latest value per key — useful for event sourcing / state stores.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.