litep2p: Provide partial results to speedup GetRecord queries (#7099)
This PR provides the partial results of the `GetRecord` kademlia query.
This significantly improves the authority discovery records, from ~37
minutes to ~2/3 minutes.
In contrast, libp2p discovers authority records in around ~10 minutes.
The authority discovery was slow because litep2p provided the records
only after the Kademlia query was completed. A normal Kademlia query
completes in around 40 seconds to a few minutes.
In this PR, partial records are provided as soon as they are discovered
from the network.
### Testing Done
Started a node in Kusama with `--validator` and litep2p backend.
The node discovered 996/1000 authority records in ~ 1 minute 45 seconds.

### Before & After
In this image, on the left side is libp2p, in the middle litep2p without
this PR, on the right litep2p with this PR

Closes: https://github.com/paritytech/polkadot-sdk/issues/7077
cc @paritytech/networking
---------
Signed-off-by:
Alexandru Vasile <alexandru.vasile@parity.io>
parent
d822e07d
Showing
- Cargo.lock 2 additions, 2 deletionsCargo.lock
- Cargo.toml 1 addition, 1 deletionCargo.toml
- prdoc/pr_7099.prdoc 16 additions, 0 deletionsprdoc/pr_7099.prdoc
- substrate/client/network/src/litep2p/discovery.rs 25 additions, 8 deletionssubstrate/client/network/src/litep2p/discovery.rs
- substrate/client/network/src/litep2p/mod.rs 35 additions, 52 deletionssubstrate/client/network/src/litep2p/mod.rs
Please register or sign in to comment