[zeromq-dev] Application design. Overcomplicated?

Ilja Golshtein ilejncs at narod.ru
Wed Apr 6 10:52:08 CEST 2011


Hello!

My Linux C++ application consists of several multithread processes heavily rely on 0mq.
These processes more or less follow the same design pattern.

The problem is these processes have too many 0mq interactions between threads.

Consider an example.

Imagine we are developing a Storage. The storage is able to
* put key/value pair
* get value by key
* switch datafile

Storage has several Get workers and one Put worker.

We use TCP for process communications and INPROC for thread communications.

TCP 0mq sockets: 
XRES for Get, PULL for Put, PULL for rotate datafile
INPROC 0mq sockets: 
RES for Get worker, XREQ for Get from the main thread side
PULL for Put worker, PUSH for Put from the main thread side
PUB for termination events from the signal thread side, SUB from all workers and main thread sides

In other words, poll in every worker (because of termination SUB besides main source of data) and in main thread
(because of three TCP sockets and several INPROC).

My question is what is wrong in the design above and what could be simplified.

Suggestions?

Should I move TCP PULL for Put to worker and avoid this main_thread=>worker communication?
Should I combine GET and PUT requests into one socket and use a signature to make a distinguish? 
Should I get rid of poll in workers and send some fake messages to stop threads?


Many thanks.


-- 
Best regards,
Ilja Golshtein.



More information about the zeromq-dev mailing list