WebSockets and Load Balancing, a bottleneck?

When having a bunch of systems that act as WebSocket drones and a Load Balancer in front of those drones. When a WebSocket request comes into the LB it chooses a WebSocket drone, and the WebSocket is established. (I use AWS ELB tcp SSL-terminated at ELB)

Question: Now does the created WebSocket go through the LB, or does the LB forward the WebSocket request to a WebSocket drone and thus there is a direct link between client and a WebSocket drone?

If the WebSocket connection goes through the LB, this would make the LB a huge bottleneck.

Removing the LB and handing clients a direct IP of a WebSocket drone could circumvent this bottleneck but requires creating this logic myself, which I'm planning to do (depending on this questions' answers).

So are my thoughts on how this works correct?


AWS ELB as LB

After looking at the possible duplicate suggested by Pavel KI conclude that the WebSocket connection will go through the AWS ELB, as in:

Browser <--WebSocket--> LB <--WebSocket--> WebSocketServer

This makes the ELB a bottleneck, what I would have wanted is:

Browser <--WebSocket--> WebSocketServer

Where the ELB is only used to give the client a hostname/IP of an available WebSocketServer.

DNS as LB

The above problem could be circumvented by balancing on DNS-level, as explained in the possible duplicate. Since that way DNS will give an IP of an available WebSocketServer when ws.myapp.com is requested.

Downside is that this would require constantly updating DNS with up/down WebSocketServer changes (if your app is elastic this becomes even more of a problem).

Custom LB

Another option could be to create a custom LB which constantly monitors WebSocketServers and gives back the IP of an available WebSocketServer when the client requests so.

Downside is that the client needs to perform a separate (AJAX) request to get the IP of an available WebSocketServer, whereas with AWS ELB the Load Balancing happens implicitly.

Conclusion

Choosing the better evil..

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

上一篇: SciPy 0.12.0和Numpy 1.6.1

下一篇: WebSockets和负载平衡是一个瓶颈?