You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by András Serény <se...@gravityrd.com> on 2014/04/08 14:56:05 UTC

Leader selection for new topic

Hi Kafka users,

as far as I understand, in Kafka 0.8.1 when auto topic creation is 
enabled and a producer starts to publish to a new topic, a leader for 
this topic is selected based on the current load on brokers. Could you 
please point me to the code where this happens?

I'd like to check the details, as when I create a new topics in rapid 
succession, they do get distributed among brokers, but not quite evenly.

Thanks a lot,
András

Re: Leader selection for new topic

Posted by Guozhang Wang <wa...@gmail.com>.
Hi,

You can follow the handleMetadataRequest in KafkaApis which would trigger a
topic creation if necessary. As for distribution, the leader is selected
currently in a round robin manner instead of based on broker's load.

Guozhang


On Tue, Apr 8, 2014 at 5:56 AM, András Serény
<se...@gravityrd.com>wrote:

> Hi Kafka users,
>
> as far as I understand, in Kafka 0.8.1 when auto topic creation is enabled
> and a producer starts to publish to a new topic, a leader for this topic is
> selected based on the current load on brokers. Could you please point me to
> the code where this happens?
>
> I'd like to check the details, as when I create a new topics in rapid
> succession, they do get distributed among brokers, but not quite evenly.
>
> Thanks a lot,
> András
>



-- 
-- Guozhang