-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Question] Cluster support planned? #11
Comments
I think you're right here, just ran into this myself too. So +1 |
Yes turbo-net does not do any clustering. I'm not sure what's involved to get that working. |
@mafintosh Thank you for the answer, it´s not that critical, as I don't want to use it for a production product yet & I´m just toying around with it. I´ll see if I can find some clues in the node sources, but I doubt that this is a trivial implementation. |
haha @asciidisco i've been doing exactly that and... it's been quite the rabbit hole |
The way it is implemented in node is quite understandable. It looks like one could create a separate package that could just wrap If I´m not missing any important point, I´d say that if it can be done as a separate package, it should be done this way, as every implementation in Therefore I´m fine with closing this. If >1 instances are needed, people could still use the "classic" load balancer approach. |
Can you give me synopsis of how node's doing it? I think your link relates to distributing workers onto 'random' ports rather than any kind of port sharing between the workers. Might be wrong though. Yeah i also wonder what the performance hit would be |
@jacktuck It´s explained in the docs itself (better than I could ever do it): https://nodejs.org/api/cluster.html#cluster_how_it_works |
If you need clustering, you can use @rayo/storm which will basically spawn your worker (server) function over all available CPU cores (you can also limit the number) and even give you a nice (still basic) cluster/worker monitoring service. 👏 Something along the lines of: const rayo = require('rayo');
const turbo = require('turbo-http');
const server = turbo.createServer();
rayo({ port: 5050, server, storm: {} })
.get('/', (req, res) => res.end('Thunderstruck by rayo, turbo and storm..!'))
.start((address) => {
console.log(`Up on port ${address.port}`);
}); In this case |
I submitted a pull request to turbo-net that enables cluster support. |
Hi. First of all, great work here. |
Any news? |
Hi there.
First of all, turbo-net & turbo-http are amazing, thank you very much :)
If I´m not mistaken, turbo-http doesn't work in cluster mode yet, as it doesn't implement the same "behind the scenes magick" as the default http module does to "share" an open port.
I´ve just, very naively, tried to map the example from the docs 1:1 - https://nodejs.org/docs/latest/api/cluster.html
So, chances are high that I´m just doing something wrong here, but if not, I´d just simply ask if it is planned to implement cluster compat., or if I should go down the route of forking instances & using a traditional load balancer instead of cluster mode?
The text was updated successfully, but these errors were encountered: