TCP transport support multiple workers on Windows
Current implementation is limited to 1 worker on Windows.
Reason: multi-workers balancing for TCP transport is based on bind-fork-read method. Windows lacks fork and socket objects aren't picklable. Thus we have no way on Windows to create multiple processes bound to one core socket object and reading it together atomically. So we need architectural solution for this.
Solution: make load ballancer process (probably only for Windows) if TCP transport is used. In ZeroMQ we have used dealer-router pattern, for TCP we'll need a process bound to ret_port and w_port. From the first one it would receive messages for workers and send them via the second one workers are connected to. Also it could use pipes instead of sockets for w_port side.
Thanks to @skizunov Details are here: #27140, #27188
@cachedout , @jacksontj : I was looking into this a bit, and I could not think of a way to create a load balancer on Windows without using socket.fromfd(). In order to load balance across processes, I found these examples on the web:
https://gist.github.com/josiahcarlson/3723597 https://gist.github.com/sunilmallya/4662837
Both examples require socket.fromfd(). I have noticed that socket.fromfd() is not supported in Python 2.7 on Windows. It is, however, supported in Python 3.x on Windows. Reference:
https://bugs.python.org/issue1378
So my question is, can you think of a way of implementing a load balancer that doesn't need socket.fromfd()? Or do you believe that this feature is gated by Python 3.x support in Salt?