How is the Node.js event system different from the Akka actor template?

I have been working with Node.js for a while and consider myself pretty good with Java. But I just discovered Akka and was immediately interested in his acting pattern (from what I understand).

Now, believing that my JavaScript skills were on par with my Scala / Java skills, I want to focus on the practicality of any system. Especially in terms of web services.

As I understand it, Node does a great job with many concurrent operations. I believe that a good Node web service for an asset management system will outperform the situation while addressing many users sending changes (in a large, intensive traffic application).

But after reading about the actors in Akka, these are stitches, it will surpass the same. And I like the idea of ​​reducing the work to pieces of size. In addition, a few years ago I dabbled in Erlang and fell in love with the messaging system that he used.

I work on many applications that deal with complex business logic, and I think it's time to jump harder to one or another. It is especially recommended that you update legacy Struts and C # applications.

In any case, avoiding holy wars, how are the two systems fundamentally different? It seems that both are aimed at achieving the same goal. It is possible that Akka's “self-healing” architecture has an advantage.

EDIT

Looks like I'm getting close voices. Please do not accept this question as "which is better, Node or akka?". I am looking for major differences in event driven libraries like Node and actors like Akka.

+81
events actor akka
Dec 12 '12 at 18:57
source share
3 answers

Without going into details (which I know little about with Node.js), the main difference is that Node.js only supports concurrency without parallelism, while Akka supports both. Both systems are fully event-driven and can scale to large workloads, but the lack of parallelism makes it difficult to work in Node.js (i.e. parallelism is explicitly encoded by running multiple nodes and sending requests accordingly; therefore, it is inflexible at runtime), while like Akka is pretty easy thanks to tunable multi-threaded artists. Given the small isolated units of work (acting calls), Akka will automatically reveal to you the execution.

Another significant difference is that Akka includes a system for handling failures in a structured way (provided that each actor is controlled by its parent, which is mandatory), while Node.js relies on agreements for authors to submit error conditions of callback callback. The main problem is that asynchronous systems cannot use the standard exception approach used by stack-based synchronous systems, because the "calling" code will go to various tasks by the time the callback error occurs. With a built-in error handling system, it is more likely that applications built on this system are reliable.

The above should not be exhaustive, I am sure that there are much more differences.

+55
Dec 16 '12 at 10:10
source share

I haven't used Akka yet, but it seems to be erlang-like, but in java. In erlang, all processes are similar to actors in Akka, they have mailboxes, you can send messages between them, you have supervisors, etc.

Node.js uses cooperative concurrency. This means that you enable concurrency (for example, when you call an io operation or some kind of asynchronous event). When you have a long operation (calculating something in a long cycle), all the system blocks.

Erlang uses the primary switching task. When you have a long cycle, the system may pause it to start another operation, and continue after some time. For massive concurrency Node.js, it is useful if you only perform short operations. Both support millions of customers: http://blog.caustik.com/2012/08/19/node-js-w1m-concurrent-connections/ http://blog.whatsapp.com/index.php/2012/01/1 -million-is-so-2011 /

In java, you need threads for any concurrency, otherwise you cannot pause execution inside the function that erlang does (actually erlang pauses between function calls, but this happens with all functions). You can pause the execution of messages.

+8
Dec 15
source share

I'm not sure this is a fair comparison with a draw. I read it more like "how is an event-based system compared to an actor model?" Nodejs can support the acting model in the same way as Scala does in Akka, or C # does in Orleans, actually checks nactor , someone appears to already try.

As for comparing the event model with the actor model, I would allow wiser people to describe it. A few brief examples about the Actor model:

  • Actor model based on messages
  • Models of actors, as a rule, succeed in distributed systems (clusters). Of course, event-based systems can be distributed, but I think the actor model has a built-in distribution for distributing computations. A new request can be redirected to a new actor in another bunker, not sure how this will work based on events.
  • The Actor model supports the rejection that if hey cluster 1 apperas is not available, the observer may even find another silo to do the work.

Also check out the drama . This is another implementation of the nodejs actor model.

+6
Apr 08 '14 at 17:19
source share



All Articles