[SuperStream] Rebalance consumers in single-active mode after a TCP client reconnection #10958
Replies: 1 comment
-
This works as expected WRT the rebalancing algorithm for super streams. This may not be ideal and may be improved. Here is how it works. The active consumer for a given partition is calculated with the following formula: Let's focus on If we apply the formula When we close the active connection for When the connection for We could expect to go back to the original state, but that's quite tricky actually. This would also involve an extra rebalancing operation ( Plus the load is not balanced across the instances, but it is still possible to scale the processing for 2 partitions in the same instance by using multi-threading (one thread for each partition, to keep message ordering). Any suggestion for an improvement that would keep the state balanced and would not make the rebalancing more complicated is welcome. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
A group of consumers in SAC could be unbalanced after a TCP consumer reconnection.
Given the following configuration:
Run three processes. Each process handles one partition, like:
Consumer1
:Consumer2
:Consumer3
:Everything ok!
Now force-close one single-active TCP connection, for example, the one on
invoices-0
Consumer1
:After
Consumer1
is closed here[14:20:01] - Partition invoices-0 closed
another consumer handles the partitioninvoices-0
Consumer2
:Everything ok!
When
Consumer1
is reconnected here:[14:20:02]—Partition invoices-0 reconnected.
does not receive the consumer update event and so does not consume the messages.That's cause the unbalanced consumers.
As result, there are two active consumers:
Consumer2
with two partitions:invoices-0
andinvoices-1
Consumer3
with one partition:invoices-2
Consumer1
withZERO
active partitionsPer conversation with @acogoluegnes
Beta Was this translation helpful? Give feedback.
All reactions