-
Notifications
You must be signed in to change notification settings - Fork 281
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
Gossipsub v2.0 spec: Lower or zero duplicates by lazy mesh propagation #653
base: master
Are you sure you want to change the base?
Conversation
gossipsub v2.0 allows you to reduce the number of duplicates lower or to zero trading off with more latency. It works by probabilistically deciding to forward the message eargerly or lazily to mesh peers. If it decides to send eargerly, it just forwards the message right away. If it decides to send lazily, it sends IANNOUNCE instead and waits for INEED before sending the actual messages. Notice that if the probability is configured to be 1, it guarantees that each node will receives exactly one copy of messages, which means no duplicates.
## Future Improvements | ||
|
||
- Penalize peers that don't send the message in time, after sending `INEED`. | ||
- Let publishers just send the full content of messages to mesh peers, rather than `IANNOUNCE`, because no one has really seen the message before. This saves one RTT, but it will kill anonymity so we are not sure yet to do it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think publishers should just flood publish the message, as we currently do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have allowed that as long as D_announce
is less than D
https://github.com/libp2p/specs/pull/653/files#diff-f85861c1fe2084ec5cd59445f67d62b9bfd20e6eb0d879801833af26ebf8c107R139
However, we stop it if the protocol becomes fully announcement based
message ControlMessage { | ||
// messages from v1.2 | ||
repeated ControlIAnnounce iannounce = 6; | ||
repeated ControlINeed ineed = 7; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we just do this with IWANT?
In fact we could just send IHAVEs instead of using INEED.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasoning was that this would function very differently from IHAVE/IWANT
which is emitted periodically. While message announcements were meant to always be immediate and be primarily be used for message propagation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm ok, fair enough.
We also need to consider the interplay of IDONTWANT and IANNOUNCE as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just say that if we received IDONTWANT before, we won't send IANNOUNCE.
In general I like the direction of where this is going. However, it begs the question: Do we need the new control messages? We could do it by reusing IHAVE/IWANT. |
IMO, we may need to consider a few issues related to the duplicate-count problem in GossipSub:
The same can happen to INEED messages. A peer is already downloading a message, and it sends another INEED request. |
I would like to note that this can happen only when If |
We have thought about that and we thought that
|
It depends on the message size and situation: |
We would queue the multiple announcements we receive and only send
|
Yeah, you have to configure the timeout carefully. |
Yes, the peer responding to 'INEEDs+IWANTs' can get overwhelmed, and may require much higher time for responding to these requests (depending on the message size). |
Another thing we could consider is the size of the messages; maybe small messages should always be eagerly forwarded and large messages could be just announced. |
Responding to |
This PR supersedes #652
This extension allows lazy propagation to mesh peers to reduce the number of duplicates (which can reach zero) in the network trading off with more latency.
Instead of sending the messages to mesh peers right away, it tosses a coin to decide whether to send it lazily or eagerly.
If it decides to send eagerly, it just forwards the message right away.
If it decides to send lazily, it sends IANNOUNCE instead and waits for INEED before sending the actual messages.
Notice that if the probability is configured to be 1, it guarantees that each node will receive exactly one copy of messages, which means no duplicates.
Authored by: @ppopth, @nisdas, @chirag-parmar
I made this PR as a draft first just to gain some visibility. We need to do simulations and further analysis to compare it with Gossipsub v1.2
Our next step would be to implement it in go-libp2p-pubsub and do simulations