elad / node-cluster-socket.io

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

Even though this solution creates many workers, the performance has dropped down that it seems that only one worker is working. #35

Closed cgzegarra closed 6 years ago

cgzegarra commented 6 years ago

Hello All:

I have an NodeJS-Express-Mongo web application. I improved the performance using NodeJS Cluster module. Transactions that were taking 30 seconds to run reduced their execution time to 8-10 seconds just by adding the Cluster module. It was amazing! But, sockets stopped working properly.

The overcome this sockets issue, I implemented this "node-cluster-socket.io" solution in my application. And everything looks like is running fine. When I start the app, 8 workers are created, sockets work nicely again, but the performance has dropped again, transactions are taking 30 secs. to run.

If I reduce the number of workers to 4,2 or even 1 worker the transactions always take 30 seconds to be completed. My guess is that only one worker is working even though cluster module is activated.

When I go back to my previous configuration and remove the socket fix, the performance improves again but sockets stop working properly.

Does anybody know what could be missing? (I basically copied and pasted the configuration in the readme file)