[zeromq-dev] How many OS threads does ZeroMQ use internally?

Jan Drabner jan at jdrabner.eu
Thu Jan 9 14:33:10 CET 2014


Hey there,

We are currently doing research for our project to figure out the best 
way to do inter-thread communication with a message queue. As we are 
using zmq for networking purposes already, it was logical to also 
research it for the above purpose.

Now, we will have a number of threads (say 5-10) communicating with each 
other to send commands, synchronize data, etc.
Each of the threads will have to communicate with a certain number of 
other threads. I figured that for this setup, making each thread a 
publisher as well as a subscriber to the other threads it wants to 
listen to would be the best bet.
However, I do not know how many internal zmq threads that would yield.

Imagine this socket situation for thread A (all threads use the same 
context, only inproc is used):
Socket for publishing
Socket for subscribing to thread B
Socket for subscribing to thread F
Socket for subscribing to thread J

How many internal zmq OS threads would be spawned for this?

If it is just one (per context), it would be fine. If it is one 
additional internal thread per our thread (or per publishing socket), it 
would probably be acceptable. If it was per socket (any kind of socket), 
however, that would be really bad as it would mean we had roughly +5 
threads per our own thread. Even if those thread do not do much, they 
would still take away too many pieces of the cake.

Hope someone can answer that question :)
Regards,
Jan





More information about the zeromq-dev mailing list