-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[API Proposal]: Adding DisposeAsync to HttpResponseMessage and HttpContent #102571
Comments
Tagging subscribers to this area: @dotnet/ncl |
What is it that a response QuicStream needs to do as part of disposal that is asynchronous? |
|
The resources it's referring to, that's the freeing of the handle? Can the freeing of that handle be done fire-and-forget from the perspective of the stream such that neither Dispose / DisposeAsync needs to wait for the ack? Connection cleanup could be responsible for ensuring any stream handles that are still being cleaned up are freed prior to the connection handle being cleaned up. |
This comment was marked as outdated.
This comment was marked as outdated.
@stephentoub It's not just about freeing the handle. Writing data to the stream is just copying them to MsQuic internal buffer (same as with sockets). The problem is that MsQuic is user space, so after app closure, everything that hasn't been flushed to the network is lost (e.g. microsoft/msquic#3842). On top of that, many applications do not dispose Technical details: to avoid any lost data (we still may lose sending ACKs) we need to wait for |
As we have a good solution to the perf problem now, we decided to close this. |
Background and motivation
The motivation for proposing the addition of
DisposeAsync
toHttpResponseMessage
andHttpContent
stems from the need to address performance issues related to the disposal of HTTP connections, particularly in the context of HTTP/3. The current implementation of synchronous disposal viaDispose
can lead to sync-over-async scenarios deep within theQuicStream
, which is not ideal.The problem is exemplified by the issue reported on GitHub (#77139), where the shutdown of HTTP/3 connections or streams was observed to be slow, significantly affecting performance metrics such as requests per second (RPS). This issue highlights the impact of the current disposal pattern on performance, especially in high-throughput scenarios.
By introducing
DisposeAsync
, we aim to provide a more efficient way to dispose of these objects, particularly when dealing with asynchronous streams. This change would allow for asynchronous cleanup operations, which are more aligned with the nature of asynchronous programming and can help avoid the aforementioned performance pitfalls.The addition of
DisposeAsync
would enable a more performant and reliable disposal mechanism, ensuring that resources are freed in a timely and non-blocking manner.In conclusion, the proposal to add
DisposeAsync
is driven by a clear need to improve the performance and reliability of HTTP connection disposal, as evidenced by real-world issues and internal analysis. This change would bring the disposal pattern in line with modern asynchronous programming practices, benefiting developers and end-users alike with more efficient resource management and better application performance./cc @ManickaP
API Proposal
API Usage
or
Alternative Designs
TODO
Risks
TODO
The text was updated successfully, but these errors were encountered: