WebSockets and Load Balancing, a bottleneck?

后端 未结 1 1430
失恋的感觉
失恋的感觉 2021-02-20 15:26

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

相关标签:
1条回答
  • 2021-02-20 16:03

    AWS ELB as LB

    After looking at the possible duplicate suggested by Pavel K I 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..

    0 讨论(0)
提交回复
热议问题