gRPC Reverse Proxy

I have been googling for a few hours and unable to find a good reverse proxy for gRPC. To elaborate a bit more, here is my problem.

Below are the details.

  1. A server that is accepting gRPC Requests.
  2. A proxy that is accepting requests from the client and relaying those gRPC Requests to the server.
  3. A client that is connecting to the proxy to get data over gRPC.

The request workflow is something like: Client —> Proxy —> Server

When a request comes from the client to the proxy to fetch a huge dataset over gRPC, if the dataset is say around 1GB, the memory usage of proxy (which is running in a docker container) increases to 1GB to fulfill that gRPC request from the client. If I provide less memory to the docker container (which is running the proxy) to serve that request, the container crashes with an error code (137) which corresponds to an Out Of Memory Kill.

The expected behavior out of the proxy is that it should be able to stream the data from the server to the client without having an increase in its own memory footprint.

To add to this, when I switch to HTTP connection for the same, I do not see this increase in memory footprint in the proxy even while requesting hundreds of MBs of data.

Sample Code in the Client:

conn, err := grpc.Dial("localhost:3080", grpc.WithInsecure(), grpc.WithDefaultCallOptions(
        grpc.MaxCallRecvMsgSize(GRPCMaxSize),
        grpc.MaxCallSendMsgSize(GRPCMaxSize),
    ))

Sample Code in the Proxy (Referred to the grpc-proxy: https://github.com/trusch/grpc-proxy):

// To accept connections from the client
grpcServer := grpc.NewServer(
        grpc.UnknownServiceHandler(
            proxy.TransparentHandler(app.HandleGRPC)),
        grpc.MaxRecvMsgSize(GRPCMaxSize), grpc.MaxSendMsgSize(GRPCMaxSize),
    )
lis, _ := net.Listen("tcp", ":"+app.ctx.grpcPort)
grpcServer.Serve(lis)

// To relay requests to the server
conn, err := grpc.DialContext(context.Background(), "dns:///"+GrpcURL, grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name), grpc.WithDefaultCallOptions(
        grpc.MaxCallRecvMsgSize(GRPCMaxSize),
        grpc.MaxCallSendMsgSize(GRPCMaxSize),
    ))

It seems like the proxy that I am using is not working as expected. Any pointers to a good reverse proxy would be really helpful.