[zeromq-dev] multi-connect REQ socket send routing

Carl Jenkins cjenkins5614 at gmail.com
Mon May 25 21:21:54 CEST 2020


Hello,

I started using zeromq for a project and have bee reading the guide (almost done with chapter 3. There is one occasion where I want to have a REQ client talk to multiple servers. I don’t plan to use the routing/load balancing pattern, with the intent to avoid single point of failure. If a server dies, I’d like the client to switch to a different server to do send-recv.

I have realized recv would block if that very host it’s talking to dies, and my solution is to set RCVTIMEO to a finite number (and LINGER to a finite number as well when socket terminates). However, for the send part, I can see send always seems to go through (I think due to buffering), and the subsequent recv would time out. This means send is still doing simple round-robin, otherwise recv would have been smooth, given other servers are healthy. I’m OK with buffering and send not reporting one server dying, but how can I ask zeromq to neglect the dead server from the round robin list?

This seems to be the documented behavior from https://zeromq.org/socket-api/ <https://zeromq.org/socket-api/>, but my tests above didn’t reproduce it:

If no services are available, then any send operation on the socket will block until at least one service becomes available. The REQ socket will not discard any messages.

Thanks,
Carl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200525/4a1e6168/attachment.htm>


More information about the zeromq-dev mailing list