Overview
Theeffect/unstable/cluster modules enable building distributed applications with:
- Entities that manage stateful behaviors
- Location-transparent RPC communication
- Automatic entity lifecycle management
- Support for distributed storage
Defining entities
Entities are distributed objects that handle RPC messages:Implementing entity handlers
Provide implementations for each RPC operation:Concurrent handlers
By default, handlers run sequentially per entity. UseRpc.fork to opt into concurrency:
Persisting RPC messages
Mark RPCs as persistent to survive restarts:Using entity clients
Call entity operations from anywhere:Setting up a cluster
Production cluster
Test cluster
UseTestRunner for local development and testing:
Running the cluster
Complete example
Entity lifecycle
- Entities are created on-demand when messages arrive
- Idle entities are passivated after
maxIdleTime - Entities resume on the next message
- State is reconstructed from persistent messages