Why does the gossip protocol in akka need to deliver it's state twice for the state change to be registered?

550 views Asked by At

I am having trouble of understanding the cluster algorithm used in Akka.

In the description in the akka Gossip Protocol it says that:

The recipient of the gossip state or the gossip status can use the gossip version (vector clock) to determine whether:

  1. it has a newer version of the gossip state, in which case it sends that back to the gossiper
  2. it has an outdated version of the state, in which case the recipient requests the current state from the gossiper by sending back its version of the gossip state
  3. it has conflicting gossip versions, in which case the different versions are merged and sent back

Step two seems a waste of communication as the gossiper sends its state twice. Once when it is noticed that it does not have the newest version, and again, when the recipient want the newest version by sending its own outdated version back.

I think I am misunderstanding this because my understanding of vector clocks and CFRD are limited, and the description given in the Akka documentation is short, and the wikipedia article is to advanced. As far as I intrepid it, is that a vector clock is an implementation of a CRDT, but that might be incorrect.

But in the end I don't understand why the gossip node needs to communicate its state twice. Please clarify.

But I think I might be misunderstanding how vector Akka Cluster

1

There are 1 answers

0
gtosto On

like it's stated in the documentation, Akka implements :

A variation of push-pull gossip is used to reduce the amount of gossip information sent around the cluster. In push-pull gossip a digest is sent representing current versions but not actual values; the recipient of the gossip can then send back any values for which it has newer versions and also request values for which it has outdated versions.

Thus, simplifying, in the case 2 when a recipient of a gossip message sees that it has an outdated version of the cluster state it asks back to the gossiper the last state. So, the first message from the gossiper to the recipient carries the versions, the second from the gossiper to the recipient carries the actual states of the nodes.

Hope this helps.