The basic Actor Model design pattern is simple. When you hear of an actor, think of it as a computer process or a function. It's some code that you're going to pass a message to, kind of like calling a function. Basically you send the actor instructions and it returns some information back to you.
The actor model can be used as a framework for modeling, understanding, and reasoning about a wide range of concurrent systems. For example: Electronic mail (email) can be modeled as an actor system. Accounts are modeled as actors and email addresses as actor addresses.
The fundamental idea of the actor model is to use actors as concurrent primitives that can act upon receiving messages in different ways: Send a finite number of messages to other actors. Spawn a finite number of new actors. Change its own internal behavior, taking effect when the next incoming message is handled.
The main difference is that actors are completely isolated from each other and they will never share memory. It's also worth noting that an actor can maintain a private state that can never be changed directly by another actor.
This is related to a previous question, if not exactly the same!
It's not such a simple question because the actor model of concurrency allows for many different types of applications to be built, from a stateful single-VM application (with a few separate actor classes) to a stateless cluster of thousands of instances of an actor class.
The core principles are the same however:
I posted a blog on learnings of actor development in Scala a few weeks ago. It's a post of a best practices and things to avoid based on a few years of experience with the paradigm.
The book 'Reactive Design Patterns' is in the making at Manning.
See: https://www.manning.com/books/reactive-design-patterns
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With