I have developed my application with Akka on a single JVM. Now I want to distribute the workload across many machines. I've started to read the documentation and got confused.
There are two ways of making Akka app to be distributed by clustering and remoting. I don't get the difference between the two. If I understand properly both are excluding themselves mutually since in configuration one need to use different provider for actor reference:
akka.remote.RemoteActorRefProvider akka.cluster.ClusterActorRefProvider
So what are the use cases? When I would choose one instead of the other?
Maybe clustering is something like superset of remoting or maybe it is the other way around?
As explained in that chapter Akka remoting is designed for communication in a peer-to-peer fashion and it has limitations for client-server setups. In particular Akka Remoting does not work transparently with Network Address Translation, Load Balancers, or in Docker containers.
Introduction. Akka Cluster provides a fault-tolerant decentralized peer-to-peer based Cluster Membership Service with no single point of failure or single point of bottleneck. It does this using gossip protocols and an automatic failure detector.
In general we recommend against using Akka Cluster and actor messaging between different services because that would result in a too tight code coupling between the services and difficulties deploying these independent of each other, which is one of the main reasons for using a microservices architecture.
Akka is an actor-based framework that claims to bring the principles of 'reactivity' into microservices architecture. To a certain extent, Akka's actors can introduce significant benefits to the system, such as high-load tolerance, easy scalability, strong failure resistance and more efficient resources use.
They are not mutually exclusive since clustering is implemented on top of remoting. The main feature of remoting is location transparency for ActorRefs. Clustering adds distributed membership on top of that. It is rarely useful to use remoting directly, clustering is preferred for most of the use cases.
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