Why Actor4j?

The aim of this project [1] was to enhance the performance in message passing. As a reference implementation Akka [2] was used. Results of the research show that intra-thread-communication is much better than inter-thread-communication. For instance, you can group actors, so they are bound to the same thread. Message queues of the actors are outsourced to the thread. The four principles of reactive manifesto [3] and the four semantic properties [4] of actor systems have been applied. Time-consuming tasks can be outsourced to ResourceActor's, which are executed by an extra ThreadPool. So the responsiveness of the actor system will not be tangented.

Promising Benchmark Results

A novel thread pool architecture was introduced to improve the performance of message passing between the actors. Actors in this implementation don’t have their own queue. It’s located on their belonging thread (use of multiple task-specific queues) that are used together. This avoids double queueing (worker-queue of the thread + message queue for every actor). Additionally, differentiating between intra-thread and inter-thread communication leads to better performance and was shown in our research paper [1]. Actors on the same thread don’t even need any synchronization protection mechanism for communicating with each other. This is one of the key advantages of this implementation. This results in a significant performance boost and can lead to a near unlimited speedup, only limited by the number of cores.

What is an Actor?

There are three axioms for actors written by Carl Hewitt [5]. “When an Actor receives a message, it can concurrently:

  • send messages to addresses of Actors that it has
  • create new Actors
  • designate how to handle the next message it receives” [6].

Compact Explanation:

“One actor is no actor” [5]. “Actors come always in groups, and collaborate through messaging. In the reality, they have asynchronous behavior. This avoids blocking behavior on the side of the caller. Actors can be executed in parallel, but the same actor only once at the same time [(‘processed in a single isolated step’ [7]), A/N]. This avoids corruption in state. They can hold state and share their state over (im) mutable messages. Actors can be passive, reactive or even proactive. They can change their behavior over time, often as a result of the messages they receive” [9]. “Actors avoids the need for expensive locking and potential deadlocks [5] [[7], A/N] through their asynchronous message passing, often realized over lock-free queues in a concurrent environment” [9]. Lock-free programming is a difficult job too. A system of actors is, in its nature, independent of a global clock (no lock-step computation) [6].

Of course, it can be tried alternatively to solve the problem by making a classical map-reduce-approach. The disadvantage is that it must always go through all layers [6] of the system for every iteration of computation (coarse granulation in time, lock-step computation). This is unnecessary for a network of loosely coupled objects (here, actors). Interacting events will always be processed near the time and are accurate (finer granulation in time).

Use Cases

The realized solutions are conceptualizations that require further completion. For any inquiries, I’m willing to help.

Actor Model in Practice

Why using the Actor Model?

License

This framework is released under an open source Apache 2.0 license.

Publications

D. A. Bauer and J. Mäkiö, “Actor4j: A Software Framework for the Actor Model Focusing on the Optimization of Message Passing,” AICT 2018: The Fourteenth Advanced International Conference on Telecommunications, IARIA, Barcelona, Spain 2018, pp. 125-134, [Online]. Available from: http://www.thinkmind.org/articles/aict_2018_8_10_10087.pdf

D. A. Bauer and J. Mäkiö, “Hybrid Cloud – Architecture for Administration Shells with RAMI4.0 Using Actor4j,” 2019 IEEE 17th International Conference on Industrial Informatics (INDIN), Helsinki, Finland 2019, pp. 79-86, [Online]. Available from: https://doi.org/10.1109/INDIN41052.2019.8972075

Status of Development

The Actor4j - Core library (v2.1.x) has no external dependencies and is also compilable as a native image with GraalVM. The minimum requirement is currently Java 17. Within the branch java-8, you find an older Java 8 version. ActorMessage is encapsulated as a Java Record. The Actor4j - Core library is now separated into sdk and runtime to provide more runtimes in the future. A specification exists for the core part of Actor4j.

Installation

I am working on a new version, 2.x for Actor4j. In the future, the new version and other libraries will be available as a Maven dependency. The entire documentation is more related to the new version 2.1.x.

Currently, you can add the following Maven dependency to your pom.xml file (not recomended):

<dependency>
	<groupId>io.actor4j</groupId>
	<artifactId>actor4j-core</artifactId>
	<version>1.0.2</version>
</dependency>		

or a SNAPSHOT (v2.1.0) with JitPack.io

<repositories>
	<repository>
		<id>jitpack.io</id>
		<url>https://jitpack.io</url>
	</repository>
</repositories>

<dependencies>
	<dependency>
		<groupId>io.actor4j</groupId>
		<artifactId>actor4j-core</artifactId>
		<version>master-SNAPSHOT</version>
	</dependency>
</dependencies>

References

[1] D. A. Bauer and J. Mäkiö, “Actor4j: A Software Framework for the Actor Model Focusing on the Optimization of Message Passing,” AICT 2018: The Fourteenth Advanced International Conference on Telecommunications, IARIA, Barcelona, Spain 2018, pp. 125-134, [Online]. Available from: http://www.thinkmind.org/articles/aict_2018_8_10_10087.pdf
[2] Lightbend (2016). Akka. http://akka.io/
[3] Jonas Bonér, Dave Farley, Roland Kuhn, and Martin Thompson (2014). The Reactive Manifesto. http://www.reactivemanifesto.org/
[4] Rajesh K. Karmani, Gul Agha (2011). Actors. In Encyclopedia of Parallel Computing, Pages 1–11. Springer. http://osl.cs.illinois.edu/media/papers/karmani-2011-actors.pdf
[5] Hewitt, Meijer and Szyperski (2012): The Actor Model (everything you wanted to know, but were afraid to ask). Lang.NEXT 2012. https://channel9.msdn.com/Shows/Going+Deep/Hewitt-Meijer-and-Szyperski-The-Actor-Model-everything-you-wanted-to-know-but-were-afraid-to-ask
[6] Carl Hewitt (2017). Creator of Actor Model. Concurrency and Strong Types for IoT. Erlang & Elixir Factory San Francisco Bay Area 2017 Conference. http://www.erlang-factory.com/sfbay2017/carl-hewitt.html
[7] J. de Koster, T. van Cutsem and W. de Meuter, “43 years of actors: a taxonomy of actor models and their key properties,” AGERE 2016: Proceedings of the 6th International Workshop on Programming Based on Actors, Agents, and Decentralized Control, 2016, pp. 31-40.
[8] Microsoft (2010). Orleans – Virtual Actors. https://www.microsoft.com/en-us/research/project/orleans-virtual-actors/
[9] D. A. Bauer and J. Mäkiö, “Hybrid Cloud – Architecture for Administration Shells with RAMI4.0 Using Actor4j,” 2019 IEEE 17th International Conference on Industrial Informatics (INDIN), Helsinki, Finland 2019, pp. 79-86, https://doi.org/10.1109/INDIN41052.2019.8972075
[10] M. Geisriegler, M. Kolodiy, S. Stani and R. Singer, “Actor Based Business Process Modeling and Execution: A Reference Implementation Based on Ontology Models and Microservices,” 2017 43rd Euromicro Conference on Software Engineering and Advanced Applications (SEAA), Vienna, 2017, pp. 359-362.
[11] N. Rodrigues, A. Pereira, P. Leitão, “Adaptive Multi-agent System for a Washing Machine Production Line”, Industrial Applications of Holonics and Multi-agent Systems, vol. 8062, pp. 212-223, 2013.
[12] Microsoft (2010). Orleans – Virtual Actors. https://www.microsoft.com/en-us/research/project/orleans-virtual-actors/
[13] M. Lehmann and M. Werner, “Gut Wetter machen! Java, Play und Akka für meteorologische Anwendungen beim Deutschen Wetterdienst,” in JavaSPEKTRUM 3/2016, 2016