After reading most of the Akka docs, I still don't understand something fairly fundamental to Akka: actor cardinality.
Meaning, if I have a particular actor, say FizzActor
, does Akka ever only create 1 instance of it, or does it spawn n-instances of it as needed? If it can spawn multiple instances of an actor class, then is this configurable (if so how/where?), or does Akka alone determine how many instances to create? Does stopping/restarting/resuming this actor class perform the action on all instances of the actor or just the one child instance? Can I assume that Akka coordinates state changes across all FizzActor
instances, so that each time I get an ActorRef
to it, I see a consistent state?
None of these seem to be covered in the docs!
Akka's primary philosophy is "no magic", i.e. if you create an actor that's what happens - one Actor is created. Refer to the docs on Creating Actors with Props for a deeper explanation.
The one case where Akka takes care of starting multiple Actors in your stead is Pool Routers, which as explained in the docs: