Is there any simulator/tool to generate messages for streaming?

Sameeksha Raina picture Sameeksha Raina · Oct 19, 2016 · Viewed 11.9k times · Source

For testing purpose, I need to simulate client for generating 100,000 messages per second and send them to kafka topic. Is there any tool or way that can help me generate these random messages?

Answer

serejja picture serejja · Oct 19, 2016

There's a built-in tool for generating dummy load, located in bin/kafka-producer-perf-test.sh (https://github.com/apache/kafka/blob/trunk/bin/kafka-producer-perf-test.sh). You may refer to https://github.com/apache/kafka/blob/trunk/tools/src/main/java/org/apache/kafka/tools/ProducerPerformance.java#L106 to figure out how to use it.

One usage example would be like that:

bin/kafka-producer-perf-test.sh --broker-list localhost:9092 --messages 10000000 --topic test --threads 10 --message-size 100 --batch-size 10000 --throughput 100000

The key here is the --throughput 100000 flag which indicated "throttle maximum message amount to approx. 100000 messages per second"