elad / node-cluster-socket.io

Writeup on how to make node.js cluster and socket.io play nice
421 stars 63 forks source link

Confused on how to run this in multiple servers #12

Closed apjithesh closed 8 years ago

apjithesh commented 8 years ago

elad, this is a great info and code that i can use for my scaling. Apologies if it is a dumb ask, as i am new into nodejs, socket.io, my confusion and issue is how can i run this in multiple servers in amazon. would it be i load balance to the servers and then run my app (nodejs/socketio) code in each server and each server will have its workers (since they will have more than one cpu)?

would be great if you can help me understand that on how to set it up

odelrio commented 8 years ago

Hi @apjithesh.

You need to set up a load balancer (Nginx, HAProxy...) along with session sticking. Have in mind:

Load balancing -> Servers (IPs or ports) Session sticking -> Workers within a server

It may help you: http://blog.davidmisshula.com/blog/2013/02/04/configure-haproxy-to-scale-multiple-nodes-with-stickiness-and-ssl/

elad commented 8 years ago

I'm closing this issue because this repository isn't a support forum... feel free to keep commenting about it though. :)