Clustering

Build distributed actor systems with gossip-based membership.

Overview

cineyma's cluster module provides:

  • Gossip Protocol — Eventually consistent membership
  • Failure Detection — Heartbeat-based node monitoring
  • Distributed Registry — Cluster-wide actor lookup
  • Location Transparency — Send to actors without knowing their location

Enable Cluster Feature

Cargo.toml
toml
1
2

Creating a Cluster Node

node.rs
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Joining a Cluster

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Node Status Lifecycle

Nodes transition through these states:

1
2
3
4
5
Node status transitions in the gossip protocol

Querying Cluster State

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Registering Actors in Cluster

1
2
3
4
5
6
7
8

When a node goes Down, its registered actors are automatically removed from the distributed registry.

Complete Example

cluster_node.rs
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

Next Steps