kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guozhang Wang <wangg...@gmail.com>
Subject Re: How does Kafka decide which Consumer out of multiple Consumer clients to assign to a single topic partition
Date Thu, 22 Aug 2013 16:31:59 GMT
Hello Dennis,

The rebalance on each consumer works by first release their owned
partitions first (releasePartitionOwnership in
ZookeeperConsumerConnector.scala) and then compute the new ownership. Hence
in your scenario it is equally possible for each one of the two consumers
to own the partition in each rebalance process. And it is  not possible to
predict which consumer will claim the ownership of the partition.


On Thu, Aug 22, 2013 at 8:53 AM, Dennis Haller <dhaller@talemetry.com>wrote:

> I have a situation where two high level consumers are being created to
> consume a single topic. There is only one partition for the topic, so I
> understand that only one Consumer will end up owning the topic and
> receiving messages. The two consumers are created from two servers in a
> redundant master - slave configuration, and it is our intention that the
> servers should start in the same configuration predictably, with all the
> Consumers active on the master server.
> However, we find after both Consumers have been created that sometimes the
> first Consumer client succeeds in owning the topic and sometimes it is the
> second. I first thought that the first Consumer  client to register with
> the topic would be retained even if subsequent Consumers also register for
> the topic, but I see sometimes the second Consumer client succeeds in
> replacing the first Consumer.
> The logs show a rebalancing algorithm working after each Consumer is
> registered.
> In this case, where there is only one topic-partition, is it possible to
> predict what Consumer client will own the topic? How is that rebalancing
> done?
> Thanks
> Dennis

-- Guozhang

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message