Skip to content

yielding in write_loop after spawn_blocking to minmize task starvation. #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sctp/src/association/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ impl Association {
}
}
};
// Yielding here seems to provide a slight (~3%) throughput performance improvement.
tokio::task::yield_now().await;

// Make a buffer sized to what we read, then copy the data we
// read from the underlying transport. We do this because the
Expand Down Expand Up @@ -522,6 +524,11 @@ impl Association {
//log::debug!("[{}] sending {} bytes done", name, raw.len());
}

// Yielding here seems to minimize deadlock risk when both requestor and
// responder are using the same tokio runtime as in the example
// data-channel-flow-control
tokio::task::yield_now().await;

if !continue_loop {
break;
}
Expand Down