Skip to content

Random gossip spec update #404

@morph-dev

Description

@morph-dev

Problem

Current Random Gossip spec indicates that node should gossip content be selecting "random node from a random bucket", repeated n times.

This has a risk of not reliably distributing content to all peers, which is desired property of random gossip.

For example, if I'm the first node that bridge offers the content to, and I randomly select peers that are not in my neighborhood, there is high likelihood that peers from my neighborhood would never actually receive the content (especially if they are new node and not present in buckets of nodes that are far from them, because their buckets were already full when they joined the network).

Some potential solutions

0. Random sampling

I just wanted to list current spec so I can easily reference it later.

I's also worth mentioning that it isn't quite clear which of the following two algorithms are specified:

  • select peer at random
  • select bucket at random, then select peer from that bucket at random

1. Weighted sampling based on distance

Instead of selecting peers/buckets with unified distribution, we can use weighted sampling such that peers that are closer to nood have higher chance of being selected for gossip. Two ideas:

1.1. Weighted peer sampling

Every peer would have weight assigned to them and n peers would be sampled based on their weights.

  • example of the weight could be: $q^{256 - log2\textunderscore distance(peer)}$
  • q can be chosen arbitrary (more on this later)

1. 2. Weighted bucket sampling + random peer from a bucket

Every bucket with at least one peer would be assigned a weight (similar to step 1). Then random bucket would be sampled based on their weights. And lastly random peer from selected bucket (uniform distribution) is selected for gossip. This process is repeated n times.

More on choosing parameter q

Selecting q can be tricky because:

  • picking too low value would lead to having close to unified distribution
  • picking too high value can make it difficult to "escape" neighborhood and propagate content to peers that are far away
    • this is somewhat less of an issue for proposal 1.1. as farther away buckets will have more peers than the one close to us

2. Partial random + partial weighted sampling

One idea that I like is to combine random (unified) sampling and weighted sampling.

For example, something like this:

  1. Select n peers based on algorithm 1.2. using q=2
  2. Select n peers at randomly

This ensures that peers from both the neighborhood and far away are represented between selected peers.

note: If we want to select the same number of peers, the n in this approach would be half of the n in previous approaches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions