3

I'm working in a project with Kafka and Akka Streams using reactive-kafka connector. We have found that reactive-kafka use it's own dispatcher (akka.kafka.default-dispatcher) but if, instance of that, we use the default akka dispatcher, all is faster (reactive-kafka dispatcher ~300 messages/s, default dispatcher ~1300 messages/s )

I wonder if to use the default dispatcher would be safe.

Thanks in advance.

RoberMP
  • 1,306
  • 11
  • 22

1 Answers1

5

No, you should not use Akka's default dispatcher. As the underlying Kafka client uses blocking it could stop the whole actor system from functioning.

Instead, you may reconfigure the akka.kafka.default-dispatcher (eg. by adding akka.kafka.default-dispatcher.thread-pool-executor.fixed-pool-size = 32 to your settings) or even better configure your own dispatcher and use it for the Alpakka Kafka connector consumers that need it.

See Akka dispatchers for how to configure a dispatcher.

Enno
  • 283
  • 2
  • 8