[zeromq-dev] 0MQ programming models

Martin Sustrik sustrik at 250bpm.com
Wed Jun 9 18:21:23 CEST 2010


Marcin,

> I'm trying to get a graps on the different programming models offered by 
> 0MQ but I'm pretty much lost. Could you point me to the best 
> documentation and sample code for 0MQ 2.X?
> 
> Specifically I was thinking about implementing the following scenario in 
> 0MQ and wonder how to do it best. 
> 
> There are many clients (C1-CN). Clients may be hosted on several 
> machines. Every client generates a request, sends it and waits for a 
> response. Responses are generated by workers (W1-WM), which are 
> symmetrical (exactly the same - every worker can service any request). 
> Workers as well may be hosted on several machines (different than 
> clients' machines). It is assumed that workers can fail, so a failed (or 
> timed out) request should be retried so that another worker picks it up 
> and generates a response. 
> 
> The typical architecture would like this:
> 
> C1 \              /W1
> C2  ---- queue --- W2
> ..                 ..
> CN /              \WM
> 
> Queue handles workers registration, load-balancing and retrying. What is 
> the best way to implement it using 0MQ?

Have a look here:

http://www.zeromq.org/blog:multithreaded-server

You want basically the same thing, the only difference being that the 
queue should be standalone application (zmq_queue) rather than 
in-process component.

Martin



More information about the zeromq-dev mailing list