gRPC How to know if a client is getting throttled

Issue

In gRPC go, how can I know if a client is getting throttled by a server.
Is there any event I could listen to to observe this?

In my case, I’m using a simple Unary.

I’ve used a tcpdump and checked for the frequency of window update event, but I guess there may be a better way to do so.

Solution

Channelz might have what you want: https://github.com/grpc/proposal/blob/master/A14-channelz.md#socket-data

You need to make a server: https://pkg.go.dev/google.golang.org/grpc@v1.44.0/channelz/service#RegisterChannelzServiceToServer, and use a grpc client to read the data (e.g. https://github.com/grpc-ecosystem/grpcdebug)

If I remember correctly, it doesn’t send signals when flowcontrol window is depleted. But it prints the window size for debugging purposes.


And note that frequency of window update event doesn’t indicate if the client is blocked on flowcontrol. Window updates are exchanges regularly to keep track of the flow control window.

Answered By – menghanl

Answer Checked By – Pedro (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.