Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

websockets with load balancer scalability

I use a load balancer with my web site. The browser initiates a websocket connection to my app server. Does the open connection consume any resources on the LB or is it direct between the browser and the app server? If there is something open on the LB isn't it a bottleneck? I mean if my LB can handle X open connections then the X+1 user could not even open a connection.

like image 539
Yaron Naveh Avatar asked Dec 24 '11 22:12

Yaron Naveh


1 Answers

It depends!

The most efficient load balancers listen for requests, do some analysis, then forward the requests; all the bits do not travel through the load balancer. The network forwarding happens at a lower network layer than http (e.g., it is not an http 302 redirect - the client never knows it happened, maintaining privacy around internal network configuration - this happens at OSI Level 4 I think).

However, some load balancers add more features, like acting as SSL endpoints or applying gzip compression. In these cases, they are processing bits as they pass through (encrypt/decrypt or compress in this case).

A picture may help. Compare the first diagram with the second & third here, noting redirection in the first that is absent in the others.

like image 90
codingoutloud Avatar answered Jan 03 '23 11:01

codingoutloud