Skip to content
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

HTTP/3: ValueTask pooling #42760

Merged
merged 3 commits into from
Aug 1, 2022
Merged

HTTP/3: ValueTask pooling #42760

merged 3 commits into from
Aug 1, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Jul 17, 2022

Pool some async methods on QuicStreamContext.

@adityamandaleeka
Copy link
Member

Do we have any data indicating that pooling here is beneficial?

@JamesNK
Copy link
Member Author

JamesNK commented Jul 26, 2022

I'll benchmark before/after once other PRs are merged and profile performance again. I doubt this change alone will have any material difference.

@JamesNK
Copy link
Member Author

JamesNK commented Jul 31, 2022

Before:
image

After:
image

@@ -371,7 +379,7 @@ private async Task DoSend()
// A client can abort a stream after it has finished sending data. We need a way to get that notification
// which is why we listen for a notification that the write-side of the stream is done.
// An exception can be thrown from the stream on client abort which will be captured and then wake up the output read.
_ = WaitForWritesCompleted();
var waitForWritesClosedTask = WaitForWritesClosedAsync();
Copy link
Member

Choose a reason for hiding this comment

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

Bad merge? This undoes #42683

Copy link
Member Author

@JamesNK JamesNK Aug 1, 2022

Choose a reason for hiding this comment

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

It's intentional. I noticed some failures when benchmarking after that change.

Also, pooling the task requires awaiting it.

Copy link
Member

Choose a reason for hiding this comment

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

_ = for Tasks and ValueTasks is almost always bad. I've seen very few counterexamples. Although it's often done for expedience when properly handling the task would be extremely difficult, it would still be better to await everything if it were easily doable.

Even if you do things like log all uncaught exceptions to make discarding tasks better, how do you know the logger is still alive sending your logs to wherever they need to go if you aren't awaiting all your tasks and properly delaying shutdown?

@JamesNK JamesNK merged commit acff643 into main Aug 1, 2022
@JamesNK JamesNK deleted the jamesnk/valuetaskpooling branch August 1, 2022 22:44
@ghost ghost added this to the 7.0-rc1 milestone Aug 1, 2022
@davidfowl davidfowl added the Perf label Aug 26, 2022
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions Perf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants