Example of Gossip in Akka Cluster

Consider a cluster with three nodes: NodeA, NodeB, and NodeC.

  1. Initial State:

    • NodeA is aware of itself but knows nothing about NodeB and NodeC.
  2. Gossip Communication:

    • NodeA gossips its state to NodeB, and NodeB updates its local view.
    • NodeB gossips to NodeC, propagating the updated state.
  3. Convergence:

    • Over multiple gossip cycles, all nodes learn about each other and converge to a consistent cluster state.
Example: Configuring Gossip Interval :

You can configure gossip settings in the application.conf file :

akka {
  cluster {
    gossip-interval = 1s          # Frequency of gossip messages
    failure-detector {
      threshold = 8.0            # Adjust failure detection sensitivity
      heartbeat-interval = 1s    # Frequency of heartbeat messages
    }
  }
}