uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.86k stars 569 forks source link

Performance in cluster mode #787

Closed GMELUM closed 1 year ago

GMELUM commented 2 years ago

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 commented 2 years ago

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!

joshxyzhimself commented 1 year ago

Worker Threads example here:

uNetworkingAB commented 1 year ago

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.