Closed qxfusion closed 12 years ago
I think you still miss https://github.com/joyent/node/wiki/node-core-vs-userland. Small part of it, that amke most value:
If you believe that something really just needs to be part of node's core library set, you should still build it as a module! It's much more likely to be pulled into node-core if people have a chance to see your great ideas in action, and if its core principles are iterated and polished and tested with real-world use.
Changing functionality that is included in node-core is very costly. We do it sometimes, but it's not easy, and carries a high risk of regressions. Better to experiment outside, and then pull it into node-core once it's stable. Once it's usable as a userland package, you may even find that it's less essential to node-core than you first thought.
@Sannis yes you rights. Now I local testing this solution, I'm create highload application but this feature is very important. NOTE: about regression - this separate module (yes), don't modify core structures (yes), solve real problem (yes) (trouble - V8 cannot execute more 1 thread per process on multiple CPU with HT support) P.S. about node-core-vs-userland - I'm read it before.
No, we are not going to make cluster even more magical. As it is, it's arguably too magical for node core. If scalable web servers wasn't the reason for node's existence, or if sharing a server FD wasn't very hard to get right, we wouldn't have it in at all. (Same with HTTP serving, actually.)
Go build this as a userland module. https://github.com/isaacs/cluster-master is pretty close to what you're describing.
existing implementation of cluster required manually manage and control process clusterisation. By default it's feature isn't required for all. Sometimes I'm want only say only "cluster" - and node cluster automatically. (additional note below)
adding module autocluster
Executing strategy: 1) Load
autocluster
module 2) [MODULE] Getting environment context and command line 3) [MODULE] fork (spawn) child worker in amount of ((CPU count) * 4) 4) [MODULE] adding every child worker from main process saved ENV and command line 5) [MODULE] adding every child worker in command line special flag--cluster-instance={$UUID$}
6) [CLIENT] ifautocluster
detect--cluster-instance
flag - forked will been stopped and will be launch of main source code otherwise - fork new processAPI
Proposal On existing implementation
Future:
NOTE: I'm think about Linux process clusterisation and failover, but I'm want this feature in node :) Now implementation in progress.