Hello All,

In my earlier mail, I am sorry I did not give lot of details on my setup
where I am measuring performance between producer and  consumer. Here are
the details:

- I am using Kafka version 0.7 downloaded from Apache web site.
- I am using a modified version of KafkaConsumerProducerDemo example that
comes with  the distribution. I have made the following modifications:

- In Producer java file:

    int messageNo = 1;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss.SSS") ;

    while(true)
    {
      String messageStr = new String("Message_" + messageNo);
      producer.send(new ProducerData<Integer, String>(topic,
       "Message produced at " + dateFormat.format(new Date())
       + ": " + messageStr));
      messageNo++;
    }


- In Consumer.java file:

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss.SSS") ;

    while(it.hasNext())
      System.out.println("Message received at " + dateFormat.format(new
Date()) + ": " + ExampleUtils.getMessage(it.next().message()));


Based on the messages on the console from consumer, I am getting values
ranging from 900ms to 1200ms per message for the time difference between
received message time and the timestamp in the message itself.

Kindly let me know where I am going wrong and are there any configuration
steps involved for getting optimal performance for the time taken for a
specific message to be fetched and the time when it was sent by producer.

Regards,
Kishore

Reply via email to