Skip to content
Advertisement

Pulsar client thread balance

I’m trying to implement a Pulsar client with multiple producers that distributes the load among the threads, but regardless the value passed on ioThreads() and on listenerThreads(), it is always overloading the first thread (> 65% cpu while the other threads are completely idle)

I have tried a few things including this “dynamic rebalancing” every hour(last method) but closing it in the middle of the process certainly is not the best approach

This is the relevant code

JavaScript

Advertisement

Answer

From what you describe, the most likely scenario is that all the topics you’re using are served by one single broker.

If that’s indeed the case, and avoiding topic load balancing across brokers, it’s normal that it’s using a single thread because all these producers will be sharing a single, pooled, TCP connection and each connection is assigned to 1 IO thread (listener threads are used for consumer listeners).

If you want to force more threads, you can increase the “Max TCP connection per each broker” setting, in order to use all the configured IO threads.

eg:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement