title: Load balance two separate node.js processes on two servers?
body: <p>I run a small socket.io node.js app that always has a small number of concurrent users. For the most part, it can run 100% of the time on a single process (whether it be on my Linode or Heroku[1]).</p>
  
  <p>I'm hoping to publicize it a bit for a few days, during which I'll expect a decent amount of traffic. This means concurrent websocket/xhr-polling connections. However, the two socket.io connections do <strong>not</strong> have to communicate with each other.</p>
  
  <p>The app was running on my Linode for quite some time, but I've recently transfered it over to a single free heroku dyno. Even running with xhr-polling (heroku doesn't support websockets natively) it is very fast.</p>
  
  <p>I'm curious how I can utilize my Linode to essentially run and load balance the app. But if it starts to slow down, push users over to the heroku dyno running (or vice versa). This should be possible with something like <a href="https://github.com/nodejitsu/node-http-proxy" rel="nofollow noreferrer">node-http-proxy</a>, but I had a tough time getting it running properly. Hopefully, I could fine tune it at which it could hit a point, or I could flick a switch and it would begin balancing users over to the second site.</p>
  
  <p>Basically, I'm just looking to be pointed in the right direction. Code would be nice, but not necessary. The solution doesn't even have to be in node.</p>
  
  <p>Thank you!</p>
  
  <p>[1] I've tried out nodejitsu as well for quite some time, and just didn't find it ready for production usage.</p>
  
  <p>Edit: Should I just use a simple roundrobin, as explained <a href="https://stackoverflow.com/questions/6586362/node-js-supports-multiple-load-balance-across-servers?rq=1">here</a>? What if I want to favor one over the other?</p>