-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Kestrel gRPC support: provide more efficient APIs for reading request and response bodies #4697
Comments
cc @davidfowl |
Yes, there are plans to get this done for ASP.NET Core 3.0. |
In addition to making the pipes available we'll also need to make every middleware that wraps the body at least partially pipes aware. E.g. Anything that wraps the body must also wrap the pipe, or replace one or the other with a redirector. See Response Compression, Response Caching, etc.. This is similar to how they handle or redirect ISendFileFeature today. |
Yes, this is a know design challenge. |
I think @jkotalik is actively involved with this work. Please reassign if that's not the case. |
One of the possible ways how to integrate with gRPC is to write a generic handler that reads http request's body (
httpContext.Request.Body
) and parses them into grpc request messages and writes grpc response messages intohttpContext.Response.Body
. This works pretty well (see prototype in https://github.com/jtattermusch/grpc-aspnetcore-experiments), but both request body and response body are instances ofSystem.IO.Stream
, which works but isn't particularly efficient (e.g. copying of the data is required, it's hard to use with memory pooling etc.) and will probably become a performance bottleneck in the future.Is there a way to access request and response bodies e.g. in terms of the new System.IO.Pipelines API?
Context: grpc/grpc#15139
The text was updated successfully, but these errors were encountered: