-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it any alternative to run deno http server in cluster mode? #5965
Comments
No, we don't have that functionality, yet, unfortunately. |
Does using Worker count? Here is a prototype:
Start the server:
In the example above, 4 HTTP servers will be started.
You can put a load balancer in front of the application and distribute the requests to each of the HTTP servers. This is not the same as using cluster in Node.js to start multiple HTTP servers, because the HTTP servers in the Workers cannot listen on the same port. |
Thanks for reply, but do You guys planing add this features or its out of focus for now? |
"same port" is a key |
@devalexqt We don’t have plans to add that feature - but I’d be open to discussing how it could be done with web workers. Basically we need the ability to send resources to other workers - then you would share the server resource... |
Yea, resource sharing with workers will be elegant solution! |
I had done a similar cluster module using the worker feature in another JS runtime called fibjs. Transferring an object's ownership to another isolation(or call it worker) is the key point. (fibjs only supports transfer network socket and Buffer, tbh, socket is enough) This is the module I wrote https://github.com/fibjs-modules/cluster-server#usage, the key implementation is https://github.com/fibjs-modules/cluster-server/blob/master/lib/cluster.js#L92 According to
Anyway, if it is possible to support transfer |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@alxtsg What's the point of starting HTTP servers within workers if you are gonna put a manual load balancer in the front? Just start 4 separate Deno HTTP server processes and manually put load balancer on the front then for even better performance. The whole point of cluster module was they do port sharing and load balancing for you. If Deno does not have that then there is no point in using workers to start listening on separate port when workers are not as efficient in IO as main thread. |
@abaldawa It depends on what you want to do and the requirements. Maybe in some cases you can't put a load balancer in front of the application for whatever reasons. |
Cluster allows to vertical scale compute e.g 1 instance with many cores. We've been doing significant work on node and found that vertical scaling an instance with 6 core and say 4 horizontal instances with load balancing has significant improvements in RPS and latency than 1 core with 24 instances and load balancing. The trade off is the memory increases but it's worth it |
I agree what in production we need to have load balancer in front of actual service (for our projects we use |
Is it possible to run deno http server on all available cpu?
The text was updated successfully, but these errors were encountered: