Load balancing web sockets and long

If I have a web application running on 3 machines that supports web sockets and a client connects to one of them, will each request always go to the same machine, or can a load balancer send it to different machines?

Basically, once a web browser establishes a connection over web-sockets, can a load-balancer send each request to different servers?

If so, which load balancers can do this?

Also, if I'm using a framwork like atmosphere that detects browser compatibility and chooses the appropriate protocol, how would this affect load-balancing opportunities?


As described in basic description of websockets protocol on Wikipedia after a handshake is done over HTTP protocol, other communication is performed over persistent TCP connection with the exact server.

So, there will be no "requests" in usual HTTP meaning, just 2 endpoints (server and client) exchanging data. That's why load balancing in usual meaning will not be possible (and usually not needed as there are quite a lot of simultaneous TCP connections that server is able to handle at once - good discussion on this point here). And that's why data send via websocket will always be received by the correct server machine (the one that is expecting it).

If you really need this, you could use L3 load-balancer as described in the post mentioned above.


"Basically, once a web browser establishes a connection over web-sockets, can a load-balancer send each request to different servers?"

If that is your desired action, yes.

Riverbed has a software load balancer that can achieve this. https://splash.riverbed.com/docs/DOC-1451

链接地址: http://www.djcxy.com/p/44718.html

上一篇: Node.js / Socket.io中针对旧版浏览器的Web Socket支持

下一篇: 负载均衡web套接字和长