1. 14

I’ve been thinking about the Actor model for concurrency, after having used a version of it on a pair of projects, and it seems like breaking problems down into actors (or FSMs and Queues, if you follow ithare) helps a lot with forcing you to think of all the different bits that you know about a given problem.

Where does the Actor model break down? I know it tends to come with a little bit of overhead that isn’t appropriate for say, heavy number crunching, but it seems to be useful in any application that has communication outside itself.

  1.  

  2. 12

    So this might seem a bit glib but I mean it in all seriousness when I say it: The actor model is a bad fit when you don’t need concurrency to solve your problem.

    If you can solve your problem synchronously and in a single thread, the added complexity of actors is probably not terribly useful for your purposes. All of this holds true for concurrency models in general.

    With a concurrent system, you now have to ensure you don’t have problems with nondeterminism. (If your actors message a lot in both directions you can start to have issues with ordering).

    With the actor model in particular, there’s also additional complexity in error handling specifically. “Let it Crash” is a good philosophy, but it’s important to determine which errors should be fatal for an actor and which ones are recoverable.

    Everything I’ve said about concurrency is double true for distribution, if you’re building a distributed system with the actor model you get a lot of benefits that can reduce the difficulty of working in distributed systems, but you’ve also taken on all of the complexity of a distributed system.

    1. 9

      I would like to point out “Let it Crash” is not inherint to the actor model. It is an aspect of certain implementations including Erlang which is the most popular implementation.

      1. 1

        Thanks!

    2. 4

      This post I just found on Google explains the benefits and problems a bit:

      https://jaksa.wordpress.com/2015/10/13/whats-wrong-with-the-actor-model/

      I’ll also note you can get safe, multi-threaded programs with Ada Ravenscar (very restrictive), Eiffel SCOOP (quite flexible), and Rust (unknown). There’s also specialist languages like Cray’s Chapel in HPC but I figured you were thinking of a more traditional one.

      1. 2

        The actor model is the only model I know of that scaled across the globe to billions of machines. This is what the internet is. It is also the basis for true object oriented programming as described by Alan Kay.

        Overall it is a far more powerful model of computation then Turing’s.

        I think the model is a bad fit if you are using a programming language that makes it cumbersome.

        1. 1

          it tends to come with a little bit of overhead that isn’t appropriate for say, heavy number crunching

          Pony disagrees:

          Pony is an open-source, object-oriented, actor-model, capabilities-secure, high performance programming language.