Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

"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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top