It's certainly not impossible to build such a thing. It's just that most would think such a thing should be a user-land project, and not built-in. While it makes hard problems a bit easier, it makes easy problems much harder.
There are plenty of user-land attempts at message-based distributed systems. It's probably safer to isolate the different parts of your system as entirely separate processes anyway. Node is nice because it's easy to distribute services across many processes that communicate via TCP, and thus can also easily scale to more servers. It takes a little more manual work to construct that network than something like Erlang, but I think that is a good thing because it's not doing any magical shit you might not have expected and not forcing you into working in a particular way. It's all about flexibility. On Sunday, 11 August, 2013 at 3:38 PM, Kevin Swiber wrote: > I'm contemplating an experiment to bring an Erlang-like "process" model to > Node.js. > > I'm curious if anyone has been down this path before or if there's prior art > I haven't stumbled upon yet. > > Background: I've been working with Node for a couple of years now. The > default answer to multi-threading Node is "don't do it." This experiment > challenges that advice. There are many benefits to multi-threading, though > they admittedly bring features not promised by Node core. I'm fine with > that. > > Inspiration: Erlang implements an Actor model for concurrency. A process > running in Erlang's VM runs on a thread underneath the covers. The VM > implements a work-stealing task scheduler to manage the load effectively. > From here on out, I'll refer to the "Erlang process" style pattern as an > Actor. (Note: I'm no expert in Erlang. Some of this might be wrong. :) > > The Node event loop is powerful, but unfortunately, not all operations are > asynchronous in nature. For problems whose solution does not fit the single > event loop pattern, I'd like to see an alternative emerge. > > Current thinking on design: > * Actors should have access to all Node's capabilities. > * Actors should run in isolated event loops. > * Actors should communicate via message passing. > * No shared state. > * Actors should take advantage of a V8 Isolate. > * A work-stealing task scheduler should be implemented under the covers. > * Actors can spawn other actors. > > The scheduler seems like one of the hardest pieces to implement (IMHO). For > that, it might be worth investigating Intel's Threading Building Blocks[1] or > the Cilk project[2]. > > Ideally, this could all be accomplished via modules without rewriting any > part of Node core. > > So... what am I missing? Is there a giant hurdle that makes this nearly > impossible? Distributed systems made of actors using arbitrary computational > complexity and having the ability to take advantage of the Node ecosystem > seems very compelling to me. > > [1] http://threadingbuildingblocks.org/ > [2] http://supertech.csail.mit.edu/cilk/ > > Cheers, > > -- > Kevin Swiber > Projects: https://github.com/kevinswiber > Twitter: @kevinswiber > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > (mailto:[email protected]) > To unsubscribe from this group, send email to > [email protected] > (mailto:[email protected]) > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > (mailto:[email protected]). > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
