In programming, what is the actor model?

I have a co-worker who is an apologist for actor model. In general, it seems to be a software architecture to be applied in distributed systems or in the Cloud .

For what I realized the concept is that there are several actors and each one is responsible for completing a certain task. It seemed to me to be something very identical to microservices itself.

Can better clarify what is from fact the model of actors? (Normally no additional questions are allowed, but if you can detail why the actor model is different from microservices, I appreciate it.)

Author: Vinicius Brasil, 2017-02-17

3 answers

Actors are isolated, single-threaded components that encapsulate their state and behavior. This is very similar to the operation of conventional messaging services, since actors receive input parameters through messages.

MicroServices are stand-alone components that by definition serve a single purpose. In theory, actors are a perfect fit for implementing environments on microServices.

Azure Service Fabric emphasizes especially the actor model explicitly defining actors. Find more information about this here: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-actors-introduction

Theoretically, actors can be seen as small microServices. Actors are directed messages, they must have a single responsibility (this is not implicit in the model, but makes sense), so there are some equivalents compared to microServices. MicroServices they can also fill other responsibilities. It is important to remember that a microservices architecture is primarily an organizational decision. It's not about scaling an application, it's about scaling a development organization. And some of the main principles of microservices, are things like deployment independence, isolation, having separate developments and deployment cycles, etc

These are things you usually don't just start using actors. An actor-based application is still a single codebase and should be deployed as a single application (at least with the current state of the available actor frames). Thus, while actors provide scaling and better concurrency management and distributed development, they still do not provide the level of separation and isolation that a microservices-based architecture provides and therefore do not meet the same needs.

In general, in a microservice architecture (MSA), the actor is the microservice itself according to http://usblogs.pwc.com/emerging-technology/what-is-microservices-architecture-think-ant-colonies-beehives-or-termite-mounds/

 8
Author: brow-joe, 2017-02-27 14:38:15

Actor Model The model of actors, which had its development started by Carl Hewitt (Mavadatt, 2002), is used in some programming languages as a method of concurrent programming. Initially, Hewitt's proposed model was a community of agents, developed in the smalltalk language, based on objects where, each object was considered as an active entity, receiving, sending and reacting to messages. Such objects as well as the interaction messages, were called actors (Guy, 2003).

Definitions of actors Second (Mavadatt, 2002), actors are competing and independent objects that they interact by sending asynchronous messages. For (Guy, 2003), an actor can have arbitrarily many "acquaintances", that is, he can "have knowledge" about others actors and send messages to these. (Lieberman, 1987) puts that actors end up with the conventional distinction between data and procedures, creating a processing competitor through the dynamic allocation of resources on a parallel machine. In the composition of such an object, one has that an actor encapsulates States, a set of methods and an active thread (Figure 1). Each actor has his own unique mailing address, serving as a target for receiving messages, which is associated with unlimited communication, thus forming a queue for receiving messages. (Varela, 2001).

Source: https://repositorio.ufsc.br/bitstream/handle/123456789/86260/203223.pdf?sequence=1&isAllowed=y

 4
Author: Denis, 2017-02-17 11:12:55

Actor Model

The actor model is a mathematical model of concurrent computing presented in 1973. The fundamental concept of the model is that everything is an actor, it being the most basic unit of operation.

This model of competition stands out because it does not share state between actors; actors can be distributed on other machines; and has a very interesting concept of error handling: the actor dies. The state not being shared, creates a more controlled environment.

Actors

Are the atom of the actor model. He who receives messages and reacts to them in some way.

An actor alone has no value, as it depends on another to send / receive messages. Ants alone do not survive.

This entity can receive messages, and with the messages it receives, it can:

  1. send messages to other actors
  2. create actors
  3. modify its state for the next incoming message

Mailbox

Messages sent to an actor are stored in an inbox ( mailbox ) and processed one by one (FIFO).

Distribution

The actor model also provides that the system must be distributed. It doesn't matter if I'm sending the message to an actor who is running on another application node. This is important when we talk about scale horizontal.

Here stands out some languages like Erlang, which is highly associated with this model. It is worth noting that Erlang only came 13 years after the actor model.

Microservices

Microservice is an architecture style for developing an application as a suite of smaller services, each running in separate processes and communicating with mechanisms such as HTTP. Although there is a similarity in the divisibility of entities between the actors and microservices, they are not interchangeable.

When talking about actor model, it speaks in different processes representing actors who communicate with messages directly. When talking about microservices, it speaks on different backends with different responsibilities communicating via a protocol, such as HTTP.

 3
Author: Vinicius Brasil, 2020-11-09 18:47:39