[nanomsg] Planning nanomsg on multithreaded and distributed applications

  • From: Roberto Fichera <kernel@xxxxxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Wed, 4 Jan 2017 18:42:19 +0100

Hi There.

I'm evaluating to introduce nanomsg as common communication library for my
multithreaded and distributed applications. I would like to know what is the 
best
approach to use for my specific use case.

My application updates thousands of separated data from many different threads.
For every data I would like to notify the changes to external subscribers.

So my idea is to have a PUB nn_socket using a TCP transport for the whole app.
Within the app, I could have a SUB nn_socket using a inproc transport 
collecting all
subscribers one for each single data (topic) to PUB. Every inproc PUB data might
wait a new data in a thread and publish the data as soon as it's available.
Finally the SUB nn_socket collecting all the data published could route the 
data up
to the PUB nn_socket for delivering outside the data. What is the best way to
"route" messages between TCP PUB (external) and INPROC SUB (internal)?

If this is ok I would like to allocate inproc publishing threads only for 
topics (data) that external
subscribers have subscribed, so having real demand, in order to optimize the 
performances.
Then this trigger another question: is there anyway to know the topic 
subscribed by a subscriber?

Any suggestion?

Thanks in advance,
Roberto Fichera.


Other related posts: