-
Notifications
You must be signed in to change notification settings - Fork 996
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
Backpressure between components #3078
Labels
tracking-issue
Issues which are the entry point to bigger projects.
Comments
mxinden
added
priority:important
The changes needed are critical for libp2p, or are blocking another project
difficulty:hard
labels
Nov 4, 2022
1 task
Relevant discussion happening here: #3411. |
Cross-referencing backpressure tracking issue for Kademlia here #3710. |
thomaseizinger
changed the title
[Tracking Issue] Backpressure
Backpressure between components
Sep 19, 2023
thomaseizinger
added
tracking-issue
Issues which are the entry point to bigger projects.
and removed
priority:important
The changes needed are critical for libp2p, or are blocking another project
difficulty:hard
labels
Sep 19, 2023
Cross-referencing a discussion around backpressure: #4585. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is backpressure
A slow consumer should slow down (i.e. backpressure) a fast producer.
Why do we need backpressure
See also coding guidelines - Bound everything.
Where do we enforce backpressure
User ->
Swarm
Swarm::dial
.ConnectionLimit
enforces boundedness at least in thePool
.User ->
NetworkBehaviour
NetworkBehaviour
viaSwarm::behaviour_mut
libp2p-kad
, manylibp2p-request-response
requests, ...libp2p-kad
have aKademlia::poll_find_closest_ready
that needs to be polled beforeKademlia::find_closest
similar toSink::poll_ready
.Swarm
->NetworkBehaviour
NetworkBehaviour
->ConnectionHandler
Swarm
does not pollNetworkBehaviour
in case it could not deliver previously returned event from theNetworkBehaviour
to the destinedConnectionHandler
.rust-libp2p/swarm/src/lib.rs
Lines 1032 to 1034 in f9b4af3
NetworkBehaviour
is blocked on single slowConnectionHandler
NetworkBehaviour
already needs to handle the case where the connection closes and thus the event is never delivered to theConnectionHandler
.ConnectionHandler
busy) while the second might be delivered. Not intuitive.NetworkBehaviour
NetworkBehaviour::poll_connection_handler_event
, providing a list ofConnectionId
s withConnectionHandler
s that are ready to receive another event.NetworkBehaviour
->Swarm
NetworkBehaviourAction::Dial
ConnectionHandler
->NetworkBehaviour
ConnectionHandler
is blocked on slowNetworkBehaviour
Connection
->ConnectionHandler
ConnectionHandler::inject_fully_negotiated_inbound
ConnectionHandler::inject_fully_negotiated_outbound
ConnectionHandler::inject_event
ConnectionHandler::poll_inject_event_ready
ConnectionHandler
->Connection
ConnectionHandlerEvent::OutboundSubstreamRequest
Stream
Related resources
max_negotiating_inbound_streams
setting #3041The text was updated successfully, but these errors were encountered: