Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1366

Resource exhaustion: huge number of "kafka-producer-network-thread | producer-xx" threads created

$
0
0

I’m having trouble with my producer process apparently exhausting its resources.
After sending a large batch of messages the JVM process has a large number of threads named as follows:
kafka-producer-network-thread | producer-xx

My producer instance is shared across threads and looks similar to this:

class MyKafkaProducer @Inject()(actorSystem: ActorSystem)(implicit mat: Materializer) {
  val config = actorSystem.settings.config.getConfig("akka.kafka.producer")
  val producerSettings = ProducerSettings(config, new StringSerializer, new StringSerializer)
  val producer         = Producer.plainSink(producerSettings)

  def send(key: String, msg: String) = {
    val record = new ProducerRecord[String, String]("topic", key, msg)
    Source.single(record).runWith(producer)
  }
}

Do I need to release producer resources somehow after invoking send?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1366