Skip to content

Backpressure in Gossipsub #4667

@mxinden

Description

@mxinden

Description

See #3078 for tracking issue on backpressure in rust-libp2p in general.

Today EnabledHandler::send_queue can grow unboundedly, where the Gossipsub NetworkBehaviour sends messages faster than the Gossipsub EnabledHandler can process them.

/// Queue of values that we want to send to the remote.
send_queue: SmallVec<[proto::RPC; 16]>,

I see two solutions:

  1. Front or tail drop in EnabledHandler once send_queue reaches a certain size.
  2. Implement backpressure between Gossipsubs NetworkBehaviour and ConnectionHandler and only forward from NetworkBehaviour to ConnectionHandler when the latter can handle another message. I.e. drop messages for a specific peer in NetworkBehaviour instead of as suggested in (1) in ConnectionHandler.

Motivation

See #3078. Prevents past failures like #4572.

Requirements

Bound send_queue, i.e. make it impossible for it to grow unboundedly.

Open questions

No response

Are you planning to do it yourself in a pull request ?

No

Metadata

Metadata

Assignees

Labels

difficulty:moderategetting-startedIssues that can be tackled if you don't know the internals of libp2p very wellhelp wantedpriority:importantThe changes needed are critical for libp2p, or are blocking another project

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions