Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the nodes floodsub sends messages to be better defined? #713

Closed
tomaka opened this issue Nov 30, 2018 · 3 comments
Closed

Should the nodes floodsub sends messages to be better defined? #713

tomaka opened this issue Nov 30, 2018 · 3 comments
Labels
difficulty:hard priority:important The changes needed are critical for libp2p, or are blocking another project
Milestone

Comments

@tomaka
Copy link
Member

tomaka commented Nov 30, 2018

Right now, when we publish a message with floodsub, this message is simply sent to all the nodes we are connected to and that are subscribed to the topic of the message.

The problem is that by itself, floodsub will never open any connection. If you just create a brand new swarm then publish a message, then nothing will happen because no connection exists. Opening a connection to a node that happens to support a topic we're interested in has to happen through a different mechanism that could be totally unrelated to floodsub.

On a theoretical level, the correct solution is to try to maintain a connection to every single node in the topology. That is however not realistically possible for any non-trivial example.
One could also argue that this is a fundamental limitation of floodsub because it is so basic, and that better pubsub systems are designed to tackle that.

@tomaka tomaka added priority:important The changes needed are critical for libp2p, or are blocking another project difficulty:hard discussion labels Nov 30, 2018
@echupriyanov
Copy link
Contributor

Thanks for pointing me at this issue.

We at Stegos (https://github.com/stegos/stegos) are heavily using Floodsub for communications. To solve the topology problem, we have created custom libp2p protocol to form a connected (but not fully meshed) network of the nodes, and run this protocol alongside the Floodsub over the same TCP connection.

So, it's probably ok for Floodsub to operate on all open connections.

What is really concerns me, is that in not fully meshed network, we can have like 2 not directly connected nodes subscribed to the same topic, and intermediate nodes which are not subscribed to this topic wouldn't route messages between them. But, probably, that is fine too.

@tomaka
Copy link
Member Author

tomaka commented Jan 10, 2019

What is really concerns me, is that in not fully meshed network, we can have like 2 not directly connected nodes subscribed to the same topic, and intermediate nodes which are not subscribed to this topic wouldn't route messages between them. But, probably, that is fine too.

Floodsub initially relayed all messages, but we changed it to only relay messages from topics we are subscribed to in order to have the same behaviour as the JS and Go implementations.
Whether this is the best thing to do, I'm not sure.

@tomaka
Copy link
Member Author

tomaka commented Mar 22, 2019

After #889 it is now well-defined which nodes we send messages to, add we add and remove them from a list.

@tomaka tomaka closed this as completed Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:hard priority:important The changes needed are critical for libp2p, or are blocking another project
Projects
None yet
Development

No branches or pull requests

2 participants