Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Not only the sticky assignor preserves more assignments, it also results in a more balanced assignment.

 

Example 3

There are two consumers C0, C1, and two topics t0, t1, with 2 partitions each. Therefore, the partitions are t0p0, t0p1,t1p0, t1p1. Both consumers are subscribed to both topics.

 

The range, round robin, and sticky assignors all result in the following assignment:

ConsumerAssigned Topic Partitions
C0t0p0, t1p0
C1t0p1, t1p1

 

Now, if consumer C2 subscribed to both topics comes on board, the range assignor would produce the following (which is not a fair assignment):

ConsumerAssigned Topic Partitions
C0t0p0, t1p0
C1t0p1, t1p1
C2 

 

The round robin assignor would produce this (which is not the stickies assignment):

ConsumerAssigned Topic Partitions
C0t0p0, t1p1
C1t0p1
C2t1p0

 

The sticky assignor would move one of the partitions to the new consumer producing something like this (preserving 3 partition assignments):

ConsumerAssigned Topic Partitions
C0t0p0, t1p0
C1t0p1
C2t1p1

 

The Algorithm

The inputs to the sticky partition assignment algorithm are

...