You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kademlia has no way to signal to the user that it is not yet ready to accept a new query.
Could change the method signature to a futures::Sink style signature with poll_get_closest_peers_ready and a get_closest_peers.
Kademlia needs some criteria to decide when to return Poll::Pending in poll_get_closest_peers_ready.
Ideally no magic maximum of concurrent queries, but instead dynamic limit, e.g. based on capacity to ConnectionHandlers, or only accept new queries in case existing ones can not make progress.
Kademlia -> ConnectionHandler
Mechansim through ToSwarm::GenerateEvent does not enforce backpressure (yet).
Give query engines access to the channels to each handler, thus being able to make informed decisions where to send which request to.
On the handler side, use a new stream per request, have at most one OutboundStreamRequest in-flight, read from the channel from the NetworkBehaviour only on ConnectionEvent::FullyNegotiatedOutbound.
local ConnectionHandler to remote ConnectionHandler
See #3078 for tracking issue on backpressure in rust-libp2p in general.
Terminology
Query and request
rust-libp2p/protocols/kad/src/behaviour.rs
Lines 2493 to 2495 in 75f967f
Backpressure
Kademlia
NetworkBehaviour
Kademlia::get_closest_peers
today.rust-libp2p/protocols/kad/src/behaviour.rs
Lines 656 to 660 in 75f967f
Kademlia
has no way to signal to the user that it is not yet ready to accept a new query.futures::Sink
style signature withpoll_get_closest_peers_ready
and aget_closest_peers
.Kademlia
needs some criteria to decide when to returnPoll::Pending
inpoll_get_closest_peers_ready
.ConnectionHandler
s, or only accept new queries in case existing ones can not make progress.Kademlia
->ConnectionHandler
ToSwarm::GenerateEvent
does not enforce backpressure (yet).futures::channel::mpsc::channel
between behaviour and handler at handler creation time.OutboundStreamRequest
in-flight, read from the channel from theNetworkBehaviour
only onConnectionEvent::FullyNegotiatedOutbound
.ConnectionHandler
to remoteConnectionHandler
The text was updated successfully, but these errors were encountered: