waku-org / research

Waku Protocol Research
MIT License
3 stars 0 forks source link

Waku's maximum bandwidth for global adoption #31

Open alrevuelta opened 9 months ago

alrevuelta commented 9 months ago

TLDR: This issue aims to set the maximum bandwidth in x Mbps that each waku shard should consume so that the maximum amount of people can run a full waku node. It is up to https://github.com/waku-org/research/issues/22 to specify how this maximum will be enforced.

Conclusion: Limit to 10 Mbps each waku shard.

Introduction

Waku is designed in a way that everyone should be able to run a full node on an average laptop with a residential Internet connection, at least in one shard. This will enable true decentralization and give power to the users, since they won't need to rely on third parties to send/receive messages. Professional node operators running in data centers, can of course contribute to multiple shards, but we should keep the bandwidth/hardware requirements of single shard rather low.

This vision opposes the federated approach, where a few nodes requiring vast amounts of resources (cpu, memory, bandwidth) run in datacenters, taking the power from the user. While federated approaches are an improvement from traditional client-server architectures, waku envisions a fully peer-to-peer architecture where anyone should be able to run a node.

In order to ensure that anyone can run a node in desktop, there are two main limiting factors:

This issue focuses on i) bandwidth consumption and https://github.com/waku-org/research/issues/30 on ii) CPU/memory resources. Note that on https://github.com/waku-org/research/issues/23 an analysis on the impact on RLN was already made, but wasn't focused on scalability. Said issues do.

In https://github.com/waku-org/research/issues/22 we discussed why and how to limit the maximum bandwidth per shard, but we haven't come up with a specific number in Mbps. This issue i) presents data from the available bandwidth at different locations and ii) suggests a maximum bandwidth in Mbps that waku should enforce.

Bandwidth Availability and Usage

The following tables show:

Table [1] Download (Mbps) Upload (Mbps)
Q25 Average Q75 Q25 Average Q75
North-America 58 107 137 38 68 85
South-America 21 54 72 13 33 44
Europe 49 93 119 30 56 72
Asia 23 53 71 15 37 50
Oceania 44 84 108 27 50 63
Africa 12 26 33 7 17 22
Table [2] Median Download (Mbps) Median Upload (Mbps)
Global 83 38
Table [3] Video resolution Recommended Bandwidth
HD 3 Mbps
Full HD 5 Mbps
4K/UHD 15 Mbps

Selecting a Maximum Bandwidth

With the above data, we should be informed to take a decision on the maximum bandwidth that we should enforce per shard. With this number, we will apply the techniques explained in https://github.com/waku-org/research/issues/22 to ensure (with some statistical confidence) that the bandwidth won't exceed that number.

The tradeoff is clear:

So it's about where to draw this line.

Points to take into account:

Coming up with a number:

Conclusion: Limit to 10 Mbps each waku shard. How? Not trivial, see https://github.com/waku-org/research/issues/22#issuecomment-1727795042

Note: This number is not set in stone and is subject to modifications, but it will most likely stay in the same order of magnitude if changed.

s-tikhomirov commented 9 months ago

Upload and download bandwidth are the same

Does this not depend on the number of messages that originates from a node? Imagine that Alice is an active publisher (for example, she is a full node that thousands of light nodes connect to), while Bob is a relay node only used for reading, not publishing. Wouldn't it be the case that Alice's bandwidth consumption will be skewed towards upload bandwidth, compared to Bob's?

alrevuelta commented 8 months ago

Does this not depend on the number of messages that originates from a node? Imagine that Alice is an active publisher (for example, she is a full node that thousands of light nodes connect to), while Bob is a relay node only used for reading, not publishing. Wouldn't it be the case that Alice's bandwidth consumption will be skewed towards upload bandwidth, compared to Bob's?

Even in that case both A/B up/down bandwidth will be the same. Assuming ofc that both nodes are subscribed to the same topic. In gossipsub every node sends and receives all the messages in the topic, with some fixed amplification factor. There might be some cases where specific gossipsub config can alter this though, but afaik the differences shouldn't be much.

Note that I'm disregarding the bandwidth that Alice will consume serving the light clients, since its trivial to limit this.

vpavlin commented 8 months ago

Thanks for the detailed writeup!

I agree that our focus should be on decentralization and 10Mbps sounds reasonable.