zeromq/pyzmq — Issue #170: send() does not round-robin
Author: rbucker881
Created: 2012-01-28 03:30:42+00:00
State: open

I have 1x webserver, 1x json_rpc_server and 1x xml_rpc_server. I also have 3 workers. (everything runs on the same box)

When the worker's startup, they each have the same list of 3 possible sockets:
["tcp://127.0.0.1:9005","tcp://127.0.0.1:9006","tcp://127.0.0.1:9007"]

they each iterate through the list possible addresses until zmq does not throw an exception (see https://github.com/rbucker881/spotify_test/blob/master/src/spotify_test/echo.py)

Once the worker successfully binds it performs a blocking read.

On the web server side... each web server connects to the three addresses. When a transaction arrives, the web server performs a send(). The send() round robins nicely.

However, if one of the echo workers is killed, then the send() blocks when the round robin finally gets back to that server.

if, however, the web server binds and the worker connects, then client is able to round robin.

The complete example code is here: https://github.com/rbucker881/spotify_test