0
votes

In the Akka documentation (https://doc.akka.io/docs/akka/current/general/addressing.html) the definitions of each are

Logical Actor Paths: The unique path obtained by following the parental supervision links towards the root guardian is called the logical actor path. This path matches exactly the creation ancestry of an actor, so it is completely deterministic as soon as the actor system’s remoting configuration (and with it the address component of the path) is set.

Physical Actor Paths: While the logical actor path describes the functional location within one actor system, configuration-based remote deployment means that an actor may be created on a different network host than its parent, i.e. within a different actor system. In this case, following the actor path from the root guardian up entails traversing the network, which is a costly operation. Therefore, each actor also has a physical path, starting at the root guardian of the actor system where the actual actor object resides. Using this path as sender reference when querying other actors will let them reply directly to this actor, minimizing delays incurred by routing.

My question is: How is it possible that an actor and its parent can exist in different actor systems? Would someone please shed light on how to understand the physical path? My understanding of actor system based on reading Akka documentation (https://doc.akka.io/docs/akka/current/general/actor-systems.html) is that each actor system starts with a root actor, then its children actors, then its grandchildren actors. So every actor's parent by definition resides in the same actor system. Maybe it is my understanding of the definition of actor system is off?

3

3 Answers

1
votes

First of all it is important to note that Akka was explicitly designed with Location Transparency in mind. So it is designed to be able to run on a cluster of several different "nodes" (i.e. different JVMs instances either running on different physical machines or wrapped into different virtual machines) with minimal or even no changes in code. For example, you can configure Akka to create some Actors on remote machines or you can do the same from code. In the Akka documentation there is no distinction for "Actor System" into "logical" and "physical" ones. In the article you reference the thing called "Actor System" is actually what one might call "Physical Actor System" i.e. something running inside single JVM. But using configuration from the link above Actor in one Actor System can create a remote Actor into another physical JVM process i.e. in a different Actor System. And this is when the notion of "logical path" vs "physical path" comes into reality.

Hope this clarifies the documentation a bit.

1
votes

What is wrong with that statement? Actors can be distributed, meaning it can be co-located on the same host or on a completely different host. Depending on where the child is, you could do one of the following:

"akka://my-sys/user/service-a/worker1"                   // purely local
"akka.tcp://my-sys@host.example.com:5678/user/service-b" // remote

If you are concerned about remote supervison, it is just going to work in the same way like local supervison. Have a look at the documentation here:

https://doc.akka.io/docs/akka/2.5.4/scala/remoting.html#watching-remote-actors

1
votes

It is important to understand the difference between logical actor path and a physical actor path.

Performance of your actor-based distributed system may depend on that.

Remote deployment means that an actor may be created on a different network host than its parent, i.e. within a different actor system. In this case, following the actor path from the root guardian up entails traversing the network, which is a costly operation. Therefore, each actor also has a physical path, starting at the root guardian of the actor system where the actual actor object resides. Using this path as sender reference when querying other actors will let them reply directly to this actor, minimizing delays incurred by routing. https://getakka.net/articles/concepts/addressing.html

Notice that the logical path defines a supervision hierarchy for an actor and physical path shows where the actor deployed. A physical actor path never spans multiple actor systems.