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 812 forks source link

Using service discovery - How connections to service discovery agents are handled? Can we limit it? #936

Open EmhyrVarEmreis opened 1 year ago

EmhyrVarEmreis commented 1 year ago

I am using this lib with service discovery based on Consul. I have recentry hit Consul max connection limit per IP. It seems that every gRPC thread has its own connection to Consul. Is it how it works? Is there an option to share connections and lower number of concurrent connections to service discovery agent?

Or maybe it is entirely spring-related topic?

ST-DDT commented 1 year ago

I'm not sure how that part of spring works in combination with grpc-java.

This library uses Spring's Discovery client to resolve each @GrpcClient name to addresses and passes the target/service addresses to grpc-java. grpc-java then somehow decides which/how many connections to create for that (I assume usually one). I don't know how many connection spring opens. I think this is something that you have to debug (at least to check whether the connections are opened from spring or grpc-java. From the description this looks like a Spring DiscoveryClient issue to me. If that is the case, please open an issue in the spring-boot-consul repository and post a link to it here. Maybe they have some insights on how to improve/fix/avoid that.

ST-DDT commented 1 year ago

Could you please post the error message/logs here?