Kafka consumer strategy

As of the current 2.7, Kafka has three consumer strategies

The first is Round. By default, it is also called rotation training. It means that for the same group of consumers, the distribution method of rotation is used to determine the partition of consumer consumption.
Insert picture description here
The second is called range, which determines consumption for a group of consumers. The method is determined by dividing the total number of partitions by the total number of consumers. Generally, if it is not divisible, the remaining partitions are often allocated from the beginning. The
Insert picture description here
third type is Sticky, which is added in 0.11.x, and it is not the same as the previous two. It is the same, it is a sublimation on the range, and the first two will start from the new decision when new consumers in the same group join or old consumers withdraw, but Sticky, in the same group When a new consumer in the group joins or an old consumer exits, the new range allocation will not be started directly, but the original consumption strategy of the existing consumers will be retained, and the partitions consumed by the exiting consumers will be evenly distributed. The same applies to existing consumers, adding new consumers, and separating them from the consumption strategies of other existing consumers

However, the third consumption strategy can only be said so far. Few manufacturers have used this. People generally say that only two consumption strategies are mentioned, because one is that the birth of the third consumption strategy has not been long, and the second is that it is often Increasing and decreasing consumers’ demand is relatively small, and everyone generally calculates from the beginning of the calculation to the end of the calculation.

Guess you like

Origin blog.csdn.net/dudadudadd/article/details/114407611