-
Notifications
You must be signed in to change notification settings - Fork 10.3k
HTTP/3: ValueTask pooling #42760
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
Conversation
Do we have any data indicating that pooling here is beneficial? |
I'll benchmark before/after once other PRs are merged and profile performance again. I doubt this change alone will have any material difference. |
91df2ac
to
d462577
Compare
@@ -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(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Pool some async methods on QuicStreamContext.