Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Partition re-balance on brokers in Kafka 0.8

Tags:

apache-kafka

The relatively scarce documentation for Kafka 0.8 does not mention what the expected behaviour for balancing existing topics, partitions and replicas on brokers is.

More specifically, what is the expected behaviour on arrival of a broker and on crash of a broker (leader or not) ?

Thanks.

like image 410
CharlieP Avatar asked Nov 13 '22 06:11

CharlieP


1 Answers

I have tested those 2 cases a while ago and not under heavy load. I have one producer sending 10k messages (just a little string) synchronously to a topic, with replication factor of 2, with 2 partitions, on a cluster of 2 brokers. There are 2 consumers. Each component is deployed on a separate machine. What I have observed is :

  • On normal operation : broker 1 is leader on partition 1 and replica on partition 2. broker 2 is leader on partition 2 and replica on partition 1. Bring a broker 3 into the cluster don't trigger rebalance on partitions automatically.

  • On broker revival (crashed than reboot) : rebalancing is transparent to the producer and consumers. The rebooting broker replicate the log first and then make itself available.

  • On broker crashed (leader or not) : simulated by a kill -9 on any one broker. The producer and consumers get frozen until the ephemeral node in ZK of the killed broker is expired. After that, operations are resumed normally.

like image 88
Minh-Triet LÊ Avatar answered Nov 15 '22 09:11

Minh-Triet LÊ