grpc-ecosystem / grpc-spring

Spring Boot starter module for gRPC framework.
https://grpc-ecosystem.github.io/grpc-spring/
Apache License 2.0
3.48k stars 815 forks source link

gRPC Client - Setting up the Number of request to be queued #889

Closed banandh closed 1 year ago

banandh commented 1 year ago

Hi,

Currently we are doing performance test with our gRPC based applications, we have set of limitations with Up stream apps so we wanted to throttle the request in our app to send the limited set of request so we introduced semaphore object into. before a client makes a call acquire a semaphore and release it when it gets the response back

Semaphore object is initialized in constructor so that it can be shared for multiple thread

        @GrpcClient(value = "clien")
        private WrapperServiceFutureStub clien;

           semaphore.acquire();
    ListenableFuture<XX> XX= clien.withMaxInboundMessageSize(9999999).withMaxOutboundMessageSize(9999999)
            .withCallCredentials(new AuthToken(exchange.getProperty(Constants.AUTHORIZATION_HEADER, String.class)))
            .method(request.build());
    XX.addListener(semaphore::release, MoreExecutors.directExecutor());

Observations with the test results and Need feedback on this

  1. Even if the upstream gRPC service is up and running, client gets "Unreachable error" at times - what is the exact reason. We have configured retries to resolve the issue. But would like to understand what is happening behind it.
  2. With Semaphore count of 10 , still seeing retries so would like to know the client side connection queueing feature where we can limit the connections on the channel instead of using a separate variables
ST-DDT commented 1 year ago

I dont know the answer for either of them. Please create an issue in gpc-java and post a link to it here, so we are also aware on them. This library is only a wrapper that simplifies the usage with spring.

banandh commented 1 year ago

Thank you here is the link https://github.com/grpc/grpc-java/issues/10164