uWebSockets.js icon indicating copy to clipboard operation
uWebSockets.js copied to clipboard

Performance in cluster mode

Open GMELUM opened this issue 2 years ago • 1 comments

Need to run a node in cluster mode to increase the vertical scaling capacity? Or will the C++ module be able to use all the cores and threads in the VPS?

GMELUM avatar Aug 15 '22 13:08 GMELUM

Depends on your app, if you are very cpu heavy you could run multiple uWS.js apps on different threads/processes, but there is a cost to communicate between them. Might only need a single uWS thread where adding more won't help or even hurt, limited by kernel sys calls / network / comm between threads etc

Sorry, I'm bad at English and I use a translator =) Did I understand correctly? uWS will give me the best networking performance. And I don't need to spawn 2-3 or more uWS threads?

And to improve performance in node.js, I can use workers instead of cluster? Thanks for your help!

GMELUM avatar Aug 16 '22 17:08 GMELUM

Worker Threads example here:

  • https://github.com/uNetworking/uWebSockets.js/blob/master/examples/WorkerThreads.js

joshxyzhimself avatar Oct 06 '22 19:10 joshxyzhimself

uWS is a sharp knife, but if you decide to stab yourself with it I cannot guarantee success. It's a tool not a robot.

uNetworkingAB avatar Oct 06 '22 23:10 uNetworkingAB