audreyt / node-webworker-threads

Lightweight Web Worker API implementation with native threads
https://npmjs.org/package/webworker-threads
Other
2.3k stars 149 forks source link

How to use web-worker thread with socket.io #133

Closed manojsharma20 closed 7 years ago

manojsharma20 commented 7 years ago

Hi, I want to execute my socket.io code in separate worker limit to 10 and can be increase as per the requirement and one worker to clean the heap of the nodejs.

I have my socket.io code with me and working fine, but the issue in as the number of request increase the node server will slow down and hence web browser get hang.

Is there any way to incorporate web-worker with socket.io.

audreyt commented 7 years ago

Socket.io needs a upstream proxy (nginx or HAProxy) to scale across horizontally: http://socket.io/docs/using-multiple-nodes/

node-webworker-threads is meant for CPU-bound computations over a long period — otherwise it has no advantage over multiple processes.