Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Pluggable partition assignment strategies #218

Closed
wants to merge 2 commits into from
Closed

Conversation

pd
Copy link

@pd pd commented Feb 13, 2018

This incorporates the round robin changes from #216 (a64a8be) and
exposes the ability for users to implement their own partition assignor.
See the previous PR for more information on the round robin changes.

The tests for the two assignors now match the Java consumer's, to
validate that the behaviors match up as expected. Reviewing the
previous tests, I think all of the same scenarios are still
covered, as well.

Backwards compatibility is maintained by falling back to the value in
PartitionStrategy if the PartitionAssignor is unset.

@dim
Copy link
Member

dim commented Mar 7, 2018

@pd thanks, but it will take a little bit longer to review this (due to other commitments). I will try to do a first round in the next few days.

pd added 2 commits March 22, 2018 13:12
This is closer to the behavior of Kafka's Java consumer, as described
here:

https://github.com/apache/kafka/blob/15bc405/clients/src/main/java/org/apache/kafka/clients/consumer/RoundRobinAssignor.java#L31-L55

This is valuable in situations where you have highly disparate
partition counts. Given three group members subscribed to many topics,
only a few of which have more than one partition, the first member
will receive far more assignments than the others.
This incorporates the round robin changes from bsm#216 (a64a8be) and
exposes the ability for users to implement their own partition assignor.

The tests for the two assignors now match the Java consumer's, to
validate that the behaviors match up as expected. Reviewing the
previous tests, I _think_ all of the same scenarios are still
covered, as well.

Backwards compatibility is maintained by falling back to the value in
`PartitionStrategy` if the `PartitionAssignor` is unset.
@pd
Copy link
Author

pd commented Mar 22, 2018

@dim Just FYI, rebased this to adjust to the minor changes around this code introduced in #209.

At $DAYJOB we've been running from my fork since mid-February with no issues and much more even partition assignments across our consumers, for whatever that's worth.

@dim
Copy link
Member

dim commented Apr 17, 2018

I am currently working on the integration of a low level consumer group into sarama, see here: IBM/sarama#1083. The next release of sarama-cluster will use it. It comes with a BalanceStrategy interface which is what you are looking for. Feedback, if any, would be much appreciated.

@dim dim closed this Apr 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants