[zeromq-dev] RPC design pattern

Martin Sustrik sustrik at 250bpm.com
Mon Apr 19 12:19:53 CEST 2010

Brian Candler wrote:
> On Mon, Apr 19, 2010 at 11:01:24AM +0200, Martin Sustrik wrote:
>> Yes. This can be achieved in two ways:
>> 1. On top of 0MQ. Each client simply chooses a random server to connect to.
> But I didn't think the 0MQ API provided a way for the application to detect
> whether its chosen endpoint is reachable or not, and hence move to a
> different server.  Or have I missed something?

No. There would be no failover in this case. The server would have to 
come back online to process the request.

>> 2. Using a shared queue. All clients connect to the queue. All
>> servers connect to the queue. Queue manages fair load-balancing of
>> client requests among the servers.
> Sure - or a TCP load-balancer, if your server nodes are located near to each
> other.
> Having clients be able to failover to a secondary data centre, or load
> balance across two data centres, is still desirable.

Note that 0MQ is designed in such a way as to allow for N-hop message 
routes. In this particular context it can mean, for instance, that 
client can load-balance (and failover) between two datacenters, while 
the queue within each datacenter can load-balance (and failover) between 
service instances in the datacenter.


More information about the zeromq-dev mailing list