weima
weima

Reputation: 4902

akka actor model vs java usage in following scenario

I want to know the applicability of the Akka Actor model.

I know it is useful in the case a huge number of Actor instances are created and destroyed. e.g. a call server, where every incoming call creates an actor instance and communicates with few other actors and get killed after the call is over.

Is it also useful in the following scenario :

A server has a few processing elements (10~50) implemented over Actors. The lifetime of these processing elements is infinite. some of them do not maintain state and a few maintain state. The processing elements process the message and pass the message to other actors in a fixed manner. The system receives a huge number of messages from outside and gets passed through processing elements and goes out of the system.

My gut feeling is that we cannot get any advantage by using Akka Actor model and even implementing this server in Scala. Because the use case for which Akka is designed, is not applicable here. If the scale-up meant that processing elements be increased dynamically then it would be applicable.

For fixed topologies, I think if i implement it in Java, it is going to be more beneficial in terms of raw performance. The 'immutability' feature of Scala leads to more copies and so reduces performance. So i believe i better stick to Java.

Is my understanding correct? I a nut shell i want to know why i should leave Java and use Scala/Akka for the application scenario above. and my target is to process 1 million messages per second.

Upvotes: 1

Views: 558

Answers (1)

Arseniy Zhizhelev
Arseniy Zhizhelev

Reputation: 2401

If this question is still actual...

  1. Scala vs. Java

    • Scala gives productivity to developers.
    • Immutability decreases debugging to almost zero level.
    • GC perfectly copes with waste immutables.
  2. Akka Actors vs. other means

    • Akka has dispatcher that distributes all tasks across fixed thread pool. This allows to evenly consume available resources. This approach is much better than the fixed worker threads — the processing resources are provided to the tasks not DataFlow nodes.
  3. DataFlow implementation

    • There is a SynapseGrid library that is built on top of Akka Actors and allows easy construction of DataFlow systems distributed over fixed immortal Actors. It can even draw the DataFlow diagram (in .dot format) of the whole system. (The library is more convenient to be used with Scala.)

Upvotes: 2

Related Questions