i ran into the issue of balancing the load in kafa. So, I created a theme with 10 sections and created 2 users. 10 sections were divided and assigned to these consumers (5 sections on the first and 5 on the second), and it works fine. Sometimes the first consumer works, sometimes the second.
But at some point we may encounter a situation where, for example, the second consumer receives a message, and it takes time to process this message (for example, 10 minutes).
So my question is, how will kafka decide which section stores the message?
Round robin in this case, I think, is not a good idea, because messages in sections processed by the second consumer will not be processed until the second consumer completes the long work.
Updated!
According to @Milan Baran's answer, the load is balanced on the manufacturer's side. But in this case, even if we provide a custom implementation of the Partitioner
, there will be the same problem that the message that was stored in the section that was assigned to the consumer that performs the long-term work will not be processed until this consumer completes its long-term work.
Maybe in another place there is an additional balancer?
source share