Understand different send methods in producer
lab 3
30 mins
$ ~/apps/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 \
--create --topic benchmark --replication-factor 1 --partitions 2
- Inspect file :
src/main/java/x/lab_04/BenchmarkProducerSendModes.java
- Fix all TODO items, using Eclipse (or any other editor).
In Eclipse,
- Right click on 'src/main/java/x/lab04_benchmark/BenchmarkProducerSendModes.java'
- Run as 'Java Application'
In Eclipse console, you should see output as follows:
== BenchmarkProducerSendModes (topic=benchmark, maxMessages=100, sendMode=SYNC) done. 100 messages sent in 23.0206651 milli secs. Throughput : 4343.923147554933 msgs / sec
== BenchmarkProducerSendModes (topic=benchmark, maxMessages=100, sendMode=ASYNC) done. 100 messages sent in 20.3356646 milli secs. Throughput : 4917.468986973752 msgs / sec
== BenchmarkProducerSendModes (topic=benchmark, maxMessages=100, sendMode=FIRE_AND_FORGET) done. 100 messages sent in 20.8203518 milli secs. Throughput : 4802.992810140701 msgs / sec
TODO: inspect the throughput numbers for various modes
Discuss your findings.