Skip to main content

Module placement

Module placement 

Source
Expand description

The placement hook of a clustered node.

A single node hosts every virtual actor whose chart type it knows. In a cluster, each virtual actor lives on the node that leases its shard, so the node asks a Placement where an actor lives before it delivers a message to it or activates it. Without a placement (the default), the node behaves exactly as a single node.

The answer is a Route:

  • Route::Local: this node hosts the actor now; deliver and activate as usual.
  • Route::Remote: another node hosts it; the message goes into the given mailbox, which carries it there. Messages already waiting in the local mailbox are moved there too, and an activation on this node is deactivated first.
  • Route::Hold: no node may host it now (its shard is unowned or its owner is gone); the message waits in the local mailbox and the actor is not activated.

Placement::route sees every message to a virtual actor or a stateless worker before it is delivered, so a cluster can also balance worker requests and observe their replies.

@tg: implements:: [[decisions#Placement is a runtime hook with three answers]]

Enums§

Route
Where an actor lives now.

Traits§

Placement
Decides where virtual actors and stateless workers live in a cluster.