waku-org / research

Waku Protocol Research
MIT License
3 stars 0 forks source link

Tuning GossipSub's D parameter in Waku #44

Open alrevuelta opened 11 months ago

alrevuelta commented 11 months ago

tldr: We assess the impact of reducing the gossip sub's D parameter from 6 (current value) to 3, analyzing i) the degradation in message propagation delay and ii) the savings in bandwidth. We observe with shadow simulations that in a network with 1000 nodes and using small messages (10kB) this change (D 6->3) worsens message propagation times from 627 ms to 849 ms for 95% of the messages. But in exchange bandwidth consumption is reduced by /2 on average.

In https://github.com/waku-org/research/issues/42 we presented the expected message propagation times for the current waku configuration, mostly affected by the gossipsub configuration (D=6 with Dlow=4 and Dhigh=12) In this issue we i) explain the rationale/tradeoffs for selecting these configuration parameters and ii) how it affects the propagation delay and bandwidth. We also asses if it would make sense to change the existing configuration.

Note: We use the same simulation setup and tools as in https://github.com/waku-org/research/issues/42, see tool and branch.

As explained in https://github.com/waku-org/research/issues/42, the tradeoff behind D (amount of peers in the mesh, aka full connections) is clear:

The question is, where should waku be in this trade-off? Note that every node is free to change these parameters, so what we discuss here are the reasonable defaults. Note also that waku could have multiple "profiles" as @chaitanyaprem suggested, so eg profile1 can be thought for nodes in datacenters and profile2 for average users. Each profile having different parameters such as D values.

Theory

Using ceil(log(N)/log(D)) we can see for different amount of nodes Nand D values the relationship between the amount of hops to reach all nodes (worst case) and the bandwidth consumption. Note that ihave/iwant messages are not taken into account, since they represent a small part of the bandwidth usage.

For example:

drawing

(plot generated with this)

Relevant points in the tradeoff:

Simulations

In https://github.com/waku-org/research/issues/42 we ran simulations with the current waku configuration of D=6 (4/12). Hereunder, we present the simulation results for this scenario where:

New results (yellow, green) are presented together with the results from https://github.com/waku-org/research/issues/42 (red, blue) so that they can be compared.

drawing

Conclussions

Based on this data, we should be ready to assess: do we want to lower D to reduce the bandwidth requirement? Or at least for some "profiles"?

alrevuelta commented 11 months ago

Weekly Update

fryorcraken commented 11 months ago

@jm-clius @alrevuelta feel free to correct epic label if needed.

chaitanyaprem commented 11 months ago

I do like the suggestion of reducing D value, but wondering what was the basis on which libp2p recommends Dlow to be 4. Would be good to find the study and simulations they have done before considering reducing to 3 (which is below 4). Also I like the idea of changing this using profiles, that way nodes which can handle more connections and bandwidth help propagate messages faster in the network.