> Thanks for the quick reply. So, just confirming, if I set up 
> ClientBuilder.listenerThreads(8) and initialize 1 consumer and 1 producer, 
> then all the 8 threads would be used for processing the incoming messages in 
> a round-robin fashion. Is my understanding correct?

Yes.

> Secondly, I'm trying to understand the producerBuilder.createAsync() & 
> messageBuilder.sendAsync() concept. I understand that  sendAsync() drops the 
> message into the producer queue. Does a seperate thread pull the messages 
> from the queue and then send it to the broker? If so, is there a way to 
> configure the number of these threads? I'm trying to understand how best to 
> maintain the producer to get maximum publish throughput?

The sendAsync() will send the message immediately, it will left a pending 
callback in the queue. After the broker return the send message to the client, 
the client will remove the pending callback. This step is done in the io thread.
You can change the default IO threads by using clientBuilder.ioThreads(int 
numIoThreads). Generally speaking, this does not require a lot of threads, the 
general recommendation is your cpu cores.

Thanks,
Penghui
On Nov 5, 2020, 4:30 PM +0800, users@pulsar.apache.org, wrote:
>
> Thanks for the quick reply. So, just confirming, if I set up 
> ClientBuilder.listenerThreads(8) and initialize 1 consumer and 1 producer, 
> then all the 8 threads would be used for processing the incoming messages in 
> a round-robin fashion. Is my understanding correct?

Reply via email to