SocketCluster / socketcluster

Highly scalable realtime pub/sub and RPC framework
https://socketcluster.io
MIT License
6.15k stars 314 forks source link

SocketClister with pm2 LoadBalancer #530

Closed kevin4dhd closed 3 years ago

kevin4dhd commented 4 years ago

hello, first of all sorry for the bad english, and second, I am something new in this of the servers, I don't know how to correctly run SocketCluster in production, working with pm2 with other projects and when I want to activate the load balancer I use "pm2 start app.js -i max ", this cannot be used with sockets given the pm2 documentation and indeed, if I want to use all CPU cores with pm2 and socketcluster it doesn't work properly, I would like to know how to run in production correctly but using all the cpu cores, I will be willing to listen to any advice or criticism, thank you very much.

jondubois commented 3 years ago

You'd have to check if pm2's native load balancer supports WebSockets. Otherwise you may want to use nginx, haproxy, apache or something else to handle load balancing.