Skip to content

Create a flow control for tcp#265

Merged
mcches merged 4 commits intotokio-rs:mainfrom
atreyas:tcp-backpressure
Feb 23, 2026
Merged

Create a flow control for tcp#265
mcches merged 4 commits intotokio-rs:mainfrom
atreyas:tcp-backpressure

Conversation

@atreyas
Copy link
Collaborator

@atreyas atreyas commented Feb 14, 2026

This branch adds a FlowControl mechanism that sidechannels the queues. The control handling process essentially applies backpressure by tracking the in flight requests end to end and enforcing the tcp_capacity on the system.

The approach is not perfect, since it's side channeling the backpressure, but I tried to couple the paths and the model as straight as I could without restructuring the world. Most of the setup is essentially tracking the path where the streams are created with a flow controller. Behaviorally this should be the same as TCP outside the fact that it's not tracking through the channel and buffers used by turmoil, and instead using a full path end-to-end.

This branch adds a FlowControl mechanism that sidechannels the queues.
The control handling process essentially applies backpressure by
tracking the in flight requests end to end and enforcing the
tcp_capacity on the system.
@atreyas atreyas marked this pull request as draft February 14, 2026 22:24
@atreyas atreyas marked this pull request as ready for review February 16, 2026 17:39
@atreyas
Copy link
Collaborator Author

atreyas commented Feb 16, 2026

Related to: #168 and #264. As described, not the ideal approach, but it's the least intrusive. It does unblock certain testing fidelity that turmoil has lacked so far.

@Benjscho Benjscho requested a review from mcches February 16, 2026 23:49
@Benjscho
Copy link
Collaborator

Changes look good to me! It'll be nice to have backpressure. Probably want a review from @mcches too

Previous change eliminated a panic message that was using this.
Removed local_addr on the SocketStream that is no longer used.
@mcches mcches requested a review from marcbowes February 17, 2026 18:05
Adds lo tests for validating the turmoil's special casing around
loopback handling in turmoil.

Also addresses some formatting and clippy errors.
The tests were using sleeps to emulate a busy server.
Replaces them with pending, and removes an unnecessary
hold in one of the tests.
Copy link
Contributor

@mcches mcches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty!

@mcches mcches merged commit 3bac0af into tokio-rs:main Feb 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants