socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Horizontal Scaling

Open nambad opened this issue 14 years ago • 6 comments

Hello,

Can anyone please help on how can i have multiple instances of node and socket.io running for horizontal scaling and handling multiple clients? A small research suggested that socket.io handles horizontal scaling but unable to find any specific kind of documentation on it..

nambad avatar Dec 12 '11 11:12 nambad

Make your nodes share the clients - use the redis store lib I guess Make some type of load-balancer to spread the clients, ex. via: DNS - Google "round robin dns" HAProxy - http://stackoverflow.com/questions/4360221/haproxy-websocket-disconnection/4737648#4737648 Nginx - https://github.com/LearnBoost/socket.io/wiki/Nginx-and-Socket.io Varnish (I guess) - https://github.com/LearnBoost/socket.io/wiki/Varnish-and-Socket.IO

Some other goods links: http://blog.mixu.net/2011/08/13/nginx-websockets-ssl-and-socket-io-deployment/ http://www.letseehere.com/reverse-proxy-web-sockets https://gist.github.com/1014904

Should get you started

Jellyfrog avatar Dec 12 '11 12:12 Jellyfrog

Thanks for the reply.. Any approximate of the number of users socket.io and node can handle together at the same time???

nambad avatar Dec 12 '11 12:12 nambad

With a single-instance? 5000 connections maybe

Edit: nowjs states their lib can handle 6500 connections, it uses socket.io for communication

"Single threaded NowJS can handle up to 6500 concurrent users on the chatroom example For customers that are looking for even greater scalability and reliability, we'll soon be licensing a distributed version of NowJS > currently under development. "

Jellyfrog avatar Dec 12 '11 13:12 Jellyfrog

OK... thanks for the information buddy.. but things like nginx and HAproxy are very advanced for me... plus i am already using mongoDB/mongoose for the application. If there is a detail tutorial / documentation for scaling provided by socket.io that would have been great.

nambad avatar Dec 13 '11 04:12 nambad

Scaling is an advanced topic, so dive into manuals. +1 for HAProxy

cris avatar Dec 14 '11 20:12 cris

Closing this, as it's a question and not a bug. You can hop by our Google groups groups.google.com/group/socket_io/ for questions <3!

3rd-Eden avatar Dec 29 '11 19:12 3rd-Eden