Skip to content

Kestrel gRPC support: provide more efficient APIs for reading request and response bodies #4697

Closed
@jtattermusch

Description

@jtattermusch

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 into httpContext.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 of System.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

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestrel

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions