Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dynamically add consumers in consumer group kafka

How should I know when i have to scale the consumer in consumer group . What are the triggers for the consumers to scale when there is a fast producer ?

like image 768
Vamsi Jakkula Avatar asked Nov 06 '22 09:11

Vamsi Jakkula


1 Answers

One straight forward approach would be to get the consumer lag(this can be computed as the difference between committed offset and beginning_offset) and if the lag computed in the last n times is increasing you can scale up and vice versa. You might've to consider some edge cases for example in case consumers have gone down and lag would be increasing and the auto-scaling function might spawn more threads/machines).

like image 111
kartheek7895 Avatar answered Nov 15 '22 11:11

kartheek7895