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

Low level access to outgoing stream with HttpMessageInvoker.SendAsync / HttpContent.SerializeToStreamAsync #35358

Closed
davidni opened this issue Apr 23, 2020 · 3 comments

Comments

@davidni
Copy link
Contributor

davidni commented Apr 23, 2020

In some scenarios (see e.g. YARP proxying code to handle gRPC duplex channels) we would like to do unbuffered writes to the outbound http request stream. RawConnectionStream for example does unbuffered writes, but we only get a RawConnectionStream in response to a CONNECT request or HTTP/1.1 upgrade (source).

The precise ask on this issue is not fully formalized at this point, but we would want something along the lines of an opt-in to use RawConnectionStream for all requests in a SocketsHttpHandler so that arbitrary protocols on top of HTTP/2 (e.g. gRPC) can be proxied transparently in YARP. Because there is no such facility today, we end up resorting to brittle solutions like this, calling FlushAsync after every WriteAsync. This is brittle because it relies on the fact that the call to flush will not actually call flush on the socket. If it did, perf might be abysmal. we shouldn't rely on implementation details to achieve the high level scenario.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Net.Http untriaged New issue has not been triaged by the area owner labels Apr 23, 2020
@ghost
Copy link

ghost commented Apr 23, 2020

Tagging subscribers to this area: @dotnet/ncl
Notify danmosemsft if you want to be subscribed.

@scalablecory scalablecory added this to the Future milestone Jun 25, 2020
@scalablecory scalablecory removed the untriaged New issue has not been triaged by the area owner label Jun 25, 2020
@dotnet-policy-service dotnet-policy-service bot added backlog-cleanup-candidate An inactive issue that has been marked for automated closure. no-recent-activity labels Dec 25, 2024
@ManickaP
Copy link
Member

ManickaP commented Jan 7, 2025

@MihaZupan is this still relevant? Should we keep this around?

@dotnet-policy-service dotnet-policy-service bot removed no-recent-activity backlog-cleanup-candidate An inactive issue that has been marked for automated closure. labels Jan 7, 2025
@MihaZupan
Copy link
Member

I think we can close it, IMO calling flush after writes you want transmitted is okay (I don't see it as being worse than having a new API that did the same thing).
We should think about making such flushes cheaper in the future though, e.g. by avoiding allocations as done in the #99281 experiment.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants