问题
Is it possible to use JMeter to push messages to Apache Kafka.
How to implement producer (in JAVA) to push messages to Kafka.
Regards, Anand
回答1:
I thought there was an answer earlier, maybe not. Have you taken a look at these? I'm using the original kafkameter myself.
- https://github.com/BrightTag/kafkameter
- https://github.com/EugeneYushin/new-api-kafkameter
and tutorials on kafkameter:
- http://www.technix.in/load-testing-apache-kafka-using-kafkameter
- http://codyaray.com/2014/07/custom-jmeter-samplers-and-config-elements
For use outside of JMeter, I've found it easier to write a producer load tool in say ruby, python, or node.js than in Java. But it's personal preference. Load scalability is another matter but other languages are easier to prototype out a producer tool.
Update:
Since the original post, there's now another solution/option for JMeter:
- https://github.com/GSLabDev/pepper-box
and rather than post specific tutorials about it, you're better off googling for some mix of terms like "Pepper-Box kafka jmeter" and go over the tutorial results for those as there are quite a few. The ones from BlazeMeter should be good.
回答2:
Yes you can go with the Jmeter
by using the above external libraries given by @David, above. Just to add, I'd recommend you to have two different programs for both consumer and producer so that you'll be in more control on what's going on. Such as optimizing and changing the property files within the config according to your requirements. Even though JMeter
sounds easy on loadtesting
, I'm not sure whether you'll be able to identify the efficiency of message consumption or production, such as identifying the number of messages published or consumed within a certain amount of period (ie: if you're dealing with large number of messages).
Kafka Produce Sample given in the doc and this
来源:https://stackoverflow.com/questions/29345392/develop-apache-kafka-producer-and-load-testing-using-jmeter