Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 1.47 KB

04.1-producer-benchmark.md

File metadata and controls

52 lines (31 loc) · 1.47 KB

<< back to main index

Lab 4.1: Producer Benchmarking

Overview

Understand different send methods in producer

Depends On

lab 3

Run time

30 mins

Step 1 : Create a benchmark topic

  $  ~/apps/kafka/bin/kafka-topics.sh  --bootstrap-server localhost:9092  \
     --create --topic benchmark --replication-factor 1  --partitions 2

Step 2 : Producer

  • Inspect file : src/main/java/x/lab_04/BenchmarkProducerSendModes.java
  • Fix all TODO items, using Eclipse (or any other editor).

Step 3 : Run the producer

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

Step 4 : Class Discussion

Discuss your findings.

Bonus Lab: Try different parameters