akka.netakka.net-persistence

At What Point is a Persisted Actor Dehydrated/Terminated?


Is there documentation of the lifecycle of a ReceivePersistentActor? I'm interested in the circumstances a persistent actor is killed/stopped/dehydrated to allocate resources for other actors. Our application creates a lot of persistent actors and I'm seeing that some are Terminated. Is there a timeframe that a persistent actor has to be "inactive" before it is terminated? What other conditions are considered?


Solution

  • Actors are only terminated automatically when:

    1. Their parent is shut down or
    2. If you're running Akka.Cluster.Sharding, actors that are created via the sharding system will be automatically passivated after two minutes of inactivity: https://getakka.net/articles/clustering/cluster-sharding.html#passivation

    Normal persistent actors don't shut down on their own - they'll hang around so long as the ActorSystem and their parent actor are live.