Search code examples
apache-kafkakafka-producer-api

How to measure the number of messages produced by kafka producer per second?


I am learning Kafka for my university project, I would like to know the logging technique to monitor number of messages produced per second by Kafka producer.

Thanks for helping.


Solution

  • There are lot of Kafka metrics that are exposed on JMX. You can check the official docs here for that. As you can see there, one of the Producer metrics is request-rate (the average number of requests sent per second.). You just need to enable JMX in the producer client JVM. Some more helpful info can be found here and here.