HACKER Q&A
📣 clarry

What's a good introduction to the actor model?


I'd like to learn about the actor model, and especially about its use in real world asynchronous (networking) applications.

What I've seen so far are contrived examples that demonstrate the similarity (or differences) to OOP or just showcase message passing, but that's barely enough to get a feel for how a real program would be structured around the actor model.

Books, tutorials, and videos are welcome. It would also be nice to study the code for a small (<10k LoC) application that does more than contrived examples.


  👤 to11mtm Accepted Answer ✓
Late to the party, but...

The Distributed Job System I've written for .NET [1] uses Akka.NET under the hood.

Mind you, this runs 'distributed' in the sense that you can have multiple servers; the actors in the Execution System itself don't do anything outside of process. However, they are very much written in the actor spirit.

There's only 3 Actors, but that might fit the bill for being something that's not 'hello world' but not huge.

The entire system is about 4KLOC, And the Actor part of the system is under 1KLOC including the Class that manages the ActorSystem at runtime.

The unmerged branch has some even more advanced examples around recovery as well as a more 'pure' model around the Coordinator (In /master/ there is still a blocking call to the Queue.)

[1] https://github.com/to11mtm/oddjob


👤 Jtsummers
I'd explore the Erlang language and, specifically, building OTP applications. Anything in this [0] list should be good. I'd recommend starting with Joe Armstrong's writings. If Erlang doesn't work for you, check out Elixir. I haven't, so I can't recommend any particular books or resources on it, but I have read and heard great things about it.

Joe Armstrong did an excellent job explaining the motivation behind Erlang's concurrency model (which is based on the actor model), and the language is very practical. From there, move to other texts or resources on the OTP portions of Erlang to understand how to develop actor-based applications at scale.

[0] https://erlangcentral.org/books/


👤 chronicler
Just learn Akka, it's the most complete Actor framework out there.