how to check if server is up/down from a client

44 views
Skip to first unread message

Viktor Khristenko

unread,
Dec 8, 2021, 5:13:25 PM12/8/21
to grpc.io
Hello,

Setup:
Client, server using callback unary api

question:
How do i check from a client side that server is up/down? What I'm currently doing is to issue grpc with deadline set + wait_for_ready as false. the return code if shows UNAVAILABLE, then server is not there, otherwise needs a retry... 

Here it's not about health check service that could be used, but rather about mechanisms to check either thru channel or stub (issueing rpc)? I was also trying to query the channel state, however not quite clear what indicates an unavailable server (using grpc_connectivity_state)...

the use case is I have a client connected to N servers (1 channel per server) and does some simple load balancing with priorities. this client is actually another server ....

any help is greatly appreciated!
thanks!

VK
Reply all
Reply to author
Forward

yas...@google.com

unread,
May 31, 2023, 9:20:35 PM5/31/23
to grpc.io
Sorry for the late reply. 

From what I'm reading, health checking is exactly what you want. I don't understand why you don't want to use it. https://github.com/grpc/grpc/blob/master/doc/health-checking.md

About using the channel state - Just because a channel is not in the connected state, it does not necessarily mean that the server is down. 

Reply all
Reply to author
Forward
0 new messages