Placement and Transactions
Section titled “Placement and Transactions”Placement decides where an activation runs; transactions decide which durable writes commit.
Placement choices
Section titled “Placement choices”A definition can select Orleans’ stock placement strategies:
RandomPreferLocalActivationCountBasedResourceOptimizedHashBasedSiloRoleBased
statelessWorker permits several local activations for throughput. It is intentionally
incompatible with durable state and reminders. Its one-argument form proactively removes idle
workers; use statelessWorker maxLocalWorkers false when collectionAge should govern idle
deactivation instead.
grainFor RouterApi.contract { defaultState (fun () -> ()) placement ResourceOptimized handleQuery (_.route) route}Placement is advisory over the currently compatible silos. Test the topology you deploy; a single-silo test cannot prove distribution.
Live activation migration
Section titled “Live activation migration”context.migrateOnIdle() lets Orleans choose a destination. The overload taking a
SiloAddress supplies an explicit placement hint. Migration participants carry
activation-local values only for a successful live move; they are not durable storage and do not
survive a source-process crash.
Persistent state uses Orleans persistence, independently of migration payloads.
Distributed transactions
Section titled “Distributed transactions”Mark the participating operations transactional, configure Orleans transactions on the silo,
and acquire facets with transactionalStateFrom. A handler may be re-executed, so keep external
side effects outside the transactional retry region or make them idempotent.
A transaction covers Orleans transactional state. It does not automatically include an arbitrary database, stream publication, HTTP call, or journal provider.