Scaling to Multiple Clusters
Now we scale this out to more than one cluster. Each cluster has a set of clients and workers, and a broker that joins these together, as illustrated in Figure 3-15.
Figure 3-15. Multiple clusters
The question is, how do we get the clients of each cluster talking to the workers of the other cluster? There are a few possibilities, each with pros and cons:
Clients could connect directly to both brokers. The advantage here is that we donât need to modify the brokers or workers. However, the clients get more complex and become aware of the overall topology. If we want to add a third or fourth cluster, for example, the clients are affected. In effect, we have to move routing and failover logic into the clients, and thatâs not nice.
Workers might connect directly to both brokers. But REQ workers canât do that; they can only reply to one broker. We might use REPs, but REPs donât give us customizable broker-to-worker routing like load balancing does, only the built-in load balancing. Thatâs a fail; if we want to distribute work to idle workers, we precisely need load balancing. One solution would be to use ROUTER sockets for the worker nodes. Letâs label this âIdea #1.â
Brokers could connect to each other. This looks the neatest because it creates the fewest additional connections. We canât add clusters on the fly, but that is probably out of our ...
Get ZeroMQ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.