GRPC client stream API

88 views
Skip to first unread message

孔雪

unread,
Jul 21, 2024, 12:06:23 AM7/21/24
to grpc.io
 Hey everyone,
I'm building an API with GRPC which currently looks like this:
```
service MyService {
  rpc sendMessageStream(stream MyRequest) returns(MyResult){};
}
```
If the client invokes the GRPC API but never invokes the onCompleted method, will it occupy server-side memory resources?  

The server is implemented in Java, and the client may be python, Java or C++.

The dependency versions introduced by the server are as follows:

<dependency>
    <groupId>net.devh</groupId>
    <artifactId>grpc-spring-boot-starter</artifactId>
    <version>2.13.1.RELEASE</version>
</dependency>

Kannan Jayaprakasam

unread,
Jul 29, 2024, 8:06:37 AM7/29/24
to grpc.io
Whether resources get tied up on the server memory would depend on the actual service implementation, but the gRPC server framework itself will not cause resources to be tied up for a stopped stream, since the gRPC server would only need to process the next frame if any that arrives. The overhead on the server in such a case would be the resources used for the TCP connection that is still alive. To handle this more efficiently you should use one of the many different types of timeout settings that are available to control how long to keep an idle connection alive.
Reply all
Reply to author
Forward
0 new messages