Monitoring consumer statistics
As well as producer metrics, there are also consumer metrics.
Getting ready
For this recipe, we just need a Kafka broker up and running and JConsole installed.
How to do it...
- Start a console consumer for
test_topic
with the JMX parameters enabled:
$ JMX_PORT=10103 bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic test_topic
- Run JConsole using the following command:
$ jconsole 127.0.0.1:10103
- In the following screenshot, see the
MBeans
tab with the Kafka consumer metrics:
Figure 9.4: MBeans tab showing the Kafka consumer metrics
How it works...
Switch to the MBeans
tab in JConsole; there are several consumer metrics. They are as follows:
kafka.consumer:type=ConsumerFetcherManager,name=MaxLag,clientId=test-consumer-group
: This tells us by how many messages the consumer is lagging behind the producer.kafka.consumer:type=ConsumerFetcherManager,name=MinFetchRate,clientId=test-consumer-group
: This gives the minimum rate at which the consumer...