uWebSockets.js
uWebSockets.js copied to clipboard
Performance in cluster mode
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?
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!
Worker Threads example here:
- https://github.com/uNetworking/uWebSockets.js/blob/master/examples/WorkerThreads.js
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.