In programming, what is the actor model?

Asked

Viewed 1,090 times

12

I have a co-worker who is an advocate of model actor (model of actors, in Portuguese). In general, it seems to be a software architecture to be applied in distributed systems or in the cloud.

From what I understand the concept is that there are several actors and each one takes responsibility for completing a certain task. It seemed to me to be something very identical to Microservices.

Can you clarify what the role model really is? (Normally no additional questions are allowed, but if you can detail why the actor model is different from Microservices, I appreciate).

  • The answer below met your need?

  • @Murillogoulart in part. I’m looking for other answers. I do not think an answer with a full copy Paste is acceptable, but that is my opinion...

  • You already understand the concepts of distributed systems?

  • @Intruder Only in a superficial way.

  • My prescription is that there is confusion between the specific definitions of standards and their applications in certain frameworks. An example of this is the Azure quote, which uses but does not necessarily 'dictate' the pattern. There is also confusion with the comparison of microservices, which should be more compared to the monolithic model of architecture, but not necessarily distributed. The framework infrastructure (so that the applied standard is shown) is more in the case of Azure, maybe that’s why you’re having difficulty expressing the question in order to get answers.

3 answers

8


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

Microservices are autonomous components that by definition serve a single purpose. In theory, actors are a perfect fit for implementing environments in microservices.

Azure Service Fabric especially emphasizes the Actor model by 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 targeted messages, they should have a single responsibility (this is not implicit in the model, but makes sense), so there are some equivalents compared to microservices. Microservices can also supply other responsibilities. It is important to remember that an 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 that you don’t usually just start with using actors. An actor-based application is still a unique code base and should be deployed as a single application (at least with the current state of available actor frames). Thus, while actors provide scaling and better management of competition and distributed development, they still do not provide the level of separation and isolation that a Microservices-based architecture provides and therefore does not meet the same needs.

Generally speaking, in a Microservices 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/

4

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

Definitions of Actors Second (Mavadatt, 2002), actors are competing and independent objects that interact by asynchronous messaging. To (Guy, 2003), an actor may have arbitrarily many "known", i.e., he may "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 concurrent through dynamic resource allocation 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 mail address, serving as a target for receiving messages, which is associated with buffers of 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

3

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, being it the most basic unit of operation.

This model of competition, stands out because it does not share state among the actors; the actors may be distributed in 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

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

An actor alone has no value because he depends on another to send/receive messages. Ants alone do not survive.

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

  1. Sending messages to other actors
  2. Create actors
  3. Change your status to the next received message

Mailbox

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

Distribution

The representations of the actors model also provides that the system must be distributed. It doesn’t matter if I’m sending the message to an actor running on another machine. This is important when we talk about horizontal scale.

The programming language that is strongly associated with the actor model is the Erlang, but that only appeared 13 years after the actor model. In the Java universe we have the Akka and in Python the Pykka. This shows that this model is not limited to functional languages, as is often thought.

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 model of actors and microservices, they are not interchangeable.

When it comes to the model of actors, it speaks in different processes representing actors who communicate with messages in a direct way. When talking about microservices, it talks about different backends with different responsibilities communicating via a protocol, such as HTTP.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.