Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check grpc server availability?

Tags:

grpc

Is there any way to check that grpc-server is up without making actual procedure calls and implementing additional queries (i.e. rpc HealthCheck (Input) returns (Status))?

like image 821
skeeph Avatar asked Jul 31 '26 13:07

skeeph


1 Answers

Most clients should use the channel state API. In Java, for instance, that is available via state = managedChannel.getState(false);. Treating {IDLE, CONNECTING, READY} as "good" is appropriate in many circumstances, but if you are very latency sensitive you can only consider READY as "good" and should pass true to getState().

Note that the API does not actively monitor the service's health; it just informs whether the server is currently known to be running and reachable. If you need to know about the service's precise health, then you need to use the Health service, via RPCs. But this is generally expected to be rare, except by load balancers (and not by clients using load balancers).

like image 93
Eric Anderson Avatar answered Aug 03 '26 23:08

Eric Anderson