Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-6227

Kafka 0.11.01 New consumer - multiple consumers under same group not working as expected



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s:
    • Fix Version/s: None
    • Component/s: consumer
    • Labels:


      In Kafka 0.8 High level consumers, the consumer.id under group.id differentiates the consumers connection and manage the rebalancing the partitions in zookeeper. Our Service uses this logic and keeps the Kafka stream connection in a cache (Concurrent Hashmap). so that consecutive http client connection doesn’t have to make a stream connection, but takes from cache and read off the messages. This also helps multiple consumers under same group.id can simulatenously make connection to kafka and read off the message (load balancing).

      In Kafka, the New consumer API the design has changed. The consumer.id properties are no more supported and the connections with zookeeper are managed by Kafka itself. When 2 consumers instances under the same group attempts to make a connection simulatenously , one connection waits on consumer.poll() method until the other one (which is already active) drops the connection. http://kafka.apache.org/0110/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html That is at any point of only one active consumer instance is able to poll the messages from the topic. This slightly would change the behavior of our service that we have to restrict only one consumer connection for a group for a topic. That is we couldn’t hold the connection in cache if multiple consumer under same group needs to use the Kafka.
      I couldn’t find any properties that aids to make multiple consumer connections on the same group

      The manual partition assignment may be a work around but this is way complex to handle that in a service. This is complex because the service needs to track the consumer connections and assign the partitions of the topic and do the rebalancing (what Kafka 0.8 high level consumer does originally). Unfortunately we cannot use legacy api's n Kafka 0.11 since documentation refers about performance degradation in using old apis in new versions.

      Was there a solution devised how the highlevel consumer of kafka 0.8 can be migrated with out any change to the behavior from the users perspective




            • Assignee:
              ram_amb@yahoo.com Ramkumar
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: