0

I have been developing with Orleans actor implementation. Recently, I saw that we were scheduling a long running job on an actor, which was effectively blocking the actor since it couldn't process the next messages in its mailbox. Fortunately, Orleans provides a solution where a long running task can be scheduled on an external .Net thread and the actor is free to process next messages in the mailbox. Orleans also provides a way for the external .Net thread to send messages to actors. So, after the job was finished, we made the external .Net thread send required messages.

We were viewing this capability of Orleans as an actor being multithreaded. However, the actor model considers actors to be single threaded. Therefore, we were thinking about whether this multithreaded view of actors violates the actor model rules. When we asked this question on the Orleans forum, the response was it is much better to view external tasks/threads, external services, etc. as external resources with side effects outside of the actor. Actors can call them and they can call actors, but that doesn't make these external resources part of the actor.

Akka is another major implementation of actor model. Hence, I have following questions: -

  1. Does Akka have any similar feature like Orleans where a long running task can be given to a separate thread while the actor proceeds onto the next message? I found something similar for Akka here, which is further explained here. These links talk about multiple threads in Akka, but I am not sure.
  2. Does the existence of external resources that can communicate with actors or actor with multiple threads violate the principles of the actor model?
  • 2
  • Thanks @RobertHarvey. Don't know how I missed this post. That answers my first question. – Avinash Kumar Jun 20 at 20:39
  • Your second question is less important than whether or not your chosen strategy meets your specific needs. – Robert Harvey Jun 20 at 21:09
  • Even after reading the documentation, I am a little confused. It does talk about multiple threads but are the threads within an actor or its an external threadpool that can be leveraged? – Avinash Kumar Jun 21 at 22:51
  • "External threadpool" is not a meaningful distinction. The ThreadPool is part of the Java Runtime Environment (JRE), and Akka runs on the JRE. – Robert Harvey Jun 21 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.