The difference between Actor model and Microservices

actor-modelmicroservicesterminology

Both seem like parallel MPI communicating network of processes. I identify actors with services. Are actors more dynamic (you can create them and kill as breathing whereas service network is more static) or what?

Best Answer

Actor model - is mathematical model for concurrent computations, and microservices - an implementation of service-oriented architecture. The similarities are quite coincidental.

It's certainly possible to build microservices based on some actor model, and model some microservice architecture with actor model, but it does not mean these are equivalent. Replace "microservice system" with "email system", and it will still be true. Replace "actor model" with "Communicating sequential processes" (CSP), and it will be also "true", because CSP and actor model systems can be modelled by one another.

Given actor model you can go and implement it using microservices, or SOA, or even email, but it does not mean they are at the same level of abstraction to truly compare.

Also, actor model emphasizes buffers (can be thought of as message queues in microservices world), so some actor/microservice can be not ready while inherently asynchronous communication is still possible.

In other words, comparison with actor model can bring some creative insights at some very high level of consideration, but mostly it's apples vs oranges.

If the goal is to compare mathematical model of SOA / microservices to Actor model, then it also not trivial, because: 1) there is no agreed upon mathematical model for SOA, 2) model usually includes the purpose. And SOA/microservices modelling is very likely to be different from the actor model purpose. One example of attempt to model SOA here.

Of course, one can create actor model system with microservices and call each service an actor (refer to strict definition of what actor model is). But this does not mean there is any meaningful relation between the two in general sense.

Related Topic