Skip to main content
Passivation automatically stops actors to reclaim memory and resources. GoAkt supports two distinct mechanisms: per-actor passivation (idle-based) and system eviction (capacity-based).

Per-actor passivation

Per-actor passivation is configured per actor at spawn. The passivation manager tracks each actor and stops it when its strategy triggers. Only actors with a passivation strategy (other than LongLivedStrategy) are tracked.

Strategies

Usage

Or use WithLongLived() to opt out:

When to use

  • Grains and virtual actors (default for many grains)
  • Actors with large per-instance state
  • High churn of short-lived entities

When to avoid

  • Long-lived services that must stay up
  • Actors that handle infrequent but critical messages

System eviction

System eviction is a node-wide mechanism that limits the total number of active actors. When the count exceeds the configured limit, the framework passivates actors according to an eviction policy (LRU, LFU, or MRU). This is independent of per-actor passivation—system eviction can stop any user actor, including those with LongLivedStrategy.

Eviction policies

Configuration

Behavior

  • The eviction loop runs at the configured interval.
  • When NumActors() > limit, actors are selected by policy and passivated via Shutdown.
  • The number of actors to evict is the greater of: (total − limit) and (percentage × total / 100).
  • System actors (reserved names) are excluded. Only user actors are eligible for eviction.

When to use

  • Memory or resource constraints on a node
  • Bounding actor count regardless of per-actor strategy
  • Coarse-grained capacity management

Comparison