Why does rebalancing stop the world?

65 Views Asked by At

First of all, my kafka version is 3.4, and I know incremental cooperative rebalance is the default strategy from v3.4.

I have 4 consumers(C1,C2,C3,C4) in a consumer group, and they are subscribing topic A with 4 partitions.

So each consumer is mapped to each partition on topic A. It takes several minutes to process a message(quite long).

Now let's say, I add a new consumer C5 into same consumer group and makes it subscribe the topic B with 1 partition.

Though the topic is different, rebalancing occurs since they are in the same consumer group.

I expected that C1-C4 do not stop processing, because C5 will subscribe the different topic and transferring ownership for C1-C4 is not needed.

However, they have stopped for a couple of minutes and it has stayed in prepare-rebalance state.

In detail C1, C2, and C3 didn't have messages behind and C4 was processing the message when I added new consumer.

Then, I tried sending messages to each partition in order to give C1-C3 messages, but C1-C3 still didn't process.

After C4 finished to process, rebalancing was finally done and all started working.

Also, each partition is owned by the same consumer which has owned before rebalancing.

I guess the reason is that consumers send the first JoinGroup request to the group coordinator (I read this here, in first rebalance to check the partitions to be newly assigned) and stops working before getting response from it.

Therefore, in my case some consumers was processing the message and this takes long time, they can't send request and make others stopped.

Am I right or am I missing something?

0

There are 0 best solutions below