Lately, we are having some performance issues with our Kafka consumers and producers. We use Kafka Java API in scala. What is considered to be good practice wrt opening and closing of consumer and producer objects? I believe this is a quite open-ended question and the right answer is always depends
but I am trying to reason about this.
Can Consumers can be long-running connections and left open?
Should producers be closed whenever we are done producing messages?