I am writing a kafka consumer using @KafkaListener annotation and i got to know that there is a way we can increase the number of concurrent kafka consumers from different partition using a method in ConcurrentKafkaListenerContainerFactory
e.g. factory.setConcurrency(3);
Javadoc for setconcurrency says like this:-
The maximum number of concurrent KafkaMessageListenerContainer running. Messages from within the same partition will be processed sequentially.
Now my question is
I have a kafka topic with 144 partitions to which our application needs to consume the message and 3 instance of app is running in parallel.
I want to know how to decide the concurrency value needs to bet set in
ConcurrentKafkaListenerContainerFactory.setconcurrency (<Value>)
so that we can achieve high throughput in consuming the message.
should i use 144/3 = 48 as concurrency factor or is there a formula to derive this number ?