libp2p / specs

Technical specifications for the libp2p networking stack
https://libp2p.io
1.56k stars 273 forks source link

Gossipsub: Unsubscribe backoff #383

Closed Menduist closed 2 years ago

Menduist commented 2 years ago

In eth2, you can't really be sure at which point you will have to subscribe from a topic. So you when unsubscribe, you may have to resubscribe in the next 60 seconds

This causes a clash with the backoff, since every peer you had in your mesh when you unsubbed is now in your backoff, and forming an healthy mesh becomes tricky.

This is a bit of a corner case, but adding a setting to tune to unsub backoff really helps with this case, and doesn't cost anything, since if you stay out of the topic, you shouldn't get GRAFTed anyway.

We implemented it in nim-libp2p: https://github.com/status-im/nim-libp2p/pull/665 which drastically improved mesh health on our busy test nodes (2500 validators, which in eth2 term is stupidly big, but that's where the issue is most visible) (each validator causes some sub/unsub): image

mxinden commented 2 years ago

@vyzo can you take a look here?

mxinden commented 2 years ago

@AgeManning @divagant-martian thoughts on this as the Rust Gossipsub experts?

AgeManning commented 2 years ago

Yep. This lgtm. We'll make a PR for rust gossipsub.

mxinden commented 2 years ago

For the record, this is now implemented in rust-libp2p via https://github.com/libp2p/rust-libp2p/pull/2403 thanks to @divagant-martian.

mxinden commented 2 years ago

LGTM, but can we hold on merging until we have implementation for go and rust?

@vyzo could you tackle the Golang side?

vyzo commented 2 years ago

I'll try to make some time for this. Any takers?

mxinden commented 2 years ago

@vyzo friendly ping. I don't think anyone else from the Go side picked this up in the meantime.

vyzo commented 2 years ago

As far as I can tell, this issue has been addressed in https://github.com/libp2p/go-libp2p-pubsub/pull/473.

Menduist commented 2 years ago

Doesn't look like it, the goal of this spec is to have a tunable, different backoff when unsubscribing from a topic The PR you linked reuse the same backoff setting as a regular prune AFAICT

vyzo commented 2 years ago

ok, will make this configurable.

MarcoPolo commented 2 years ago

@vyzo if you haven't started already I can take. Seems pretty straightforward.

vyzo commented 2 years ago

Sure, go ahead!

MarcoPolo commented 2 years ago

This is now implemented in Rust, Nim, and Go. I think we can merge this. Thanks all!