30

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?

Yves M.
  • 29,855
  • 23
  • 108
  • 144
almendar
  • 1,823
  • 13
  • 23

2 Answers2

36

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.

Endre Varga
  • 1,863
  • 15
  • 9
  • 10
    "It is rarely useful to use remoting directly, clustering is preferred for most of the use cases." - That would definitely be a good thing to add to the docs. – sourcedelica Jan 26 '14 at 22:04
  • 10
    Yes it would. Especially that you can find some solutions to problems on the AKKA site - `HowTo: Common Patterns` that concentrate only on remoting. I believe those were written before clustering was introduced and to be honest this makes one a little uncertain on what path to follow. – almendar Jan 27 '14 at 08:43
5

Always best to look to the code

https://github.com/akka/akka/blob/c2983c7225eeaa035af99e0affeb5f5c841668c4/akka-cluster/src/main/scala/akka/cluster/ClusterActorRefProvider.scala

private[akka] class ClusterActorRefProvider ... extends RemoteActorRefProvider

First of all ClusterActorRefProvider is just extension of the RemoteActorRefProvider

Core features of the cluster-akka added to the remoting are:

  • cluster wide failure detection
  • routers with rootes group & pool capabilities

you'll find flavour of all this addons in the source code.

hicolour
  • 784
  • 5
  • 11