title: Websocket Load Balancing on AWS EC2
body: <p>We are building a scaled application that uses <code>WebSockets</code> on AWS EC2. We were considering using the default ELB (Elastic Load Balancing) for this, but that, unnecessarily, makes the load balancer itself a bottleneck for traffic-heavy operations (see <a href="https://stackoverflow.com/questions/18301978/websockets-and-load-balancing-a-bottleneck">this related thread</a>), so we are currently looking into a way to send the client the connection details of a "<em>good instance</em>" to connect to instead. However, the <a href="http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/Welcome.html" rel="nofollow noreferrer">Elastic Load Balancer API</a> does not seem to support a query of the sort "<em>give me (public) connection details of a good instance</em>", which is odd because that is the core functionality of any load balancer. Maybe I have just not looked at the right place?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>Currently, we are investigating two simple solutions using default implementations:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/9184895/how-do-you-get-amazons-elb-with-https-ssl-to-work-with-web-sockets">Use ELB in TCP mode</a> which tunnels all traffic through the ELB.</li>
  <li>Simply connect to the public IP of the instance that the ELB connected you to for your GET request. The second solution requires public IPs to be enabled, but does not route all traffic through the ELB.</li>
  </ol>
  
  <p>I was concerned about that very last part because I assumed that the ELB is not in the same building as the instance it gave you. But I assume, it usually is in the same building or has some other high-speed connection to the instances? In that case, the tunneling overhead is negligible.</p>
  
  <p>Both solutions seem to be equally viable, or am I overseeing something?</p>