enable client side keepalive but seeing server side initiate the ping

49 views
Skip to first unread message

eleano...@gmail.com

unread,
Jan 7, 2019, 7:56:29 PM1/7/19
to grpc.io

Hi, 

I have enabled client side keepalive and also on the server side, enable permission to send ping via NettyServerBuilder.permitKeepAliveTime(), 

however, what I see from the wireshark, the keepalive ping seems to be initiated from server side (gRPC server listens on 9096): 

Screen Shot 2019-01-07 at 4.29.01 PM.png



Any ideas why this happens ?

Thanks a lot!

Eric Anderson

unread,
Jan 10, 2019, 8:07:09 PM1/10/19
to Jin Yi, grpc.io
The client sends a keepalive ping after X time since the last read. The server does similar. If the client receives the server's ping before it does its own keepalive ping, that resets the "time since last read" timer; the server's keepalive is enough for the client to know the connection is still good.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/b6cca740-92f2-47b8-9c8b-d0bbadd825b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

eleano...@gmail.com

unread,
Jan 10, 2019, 8:41:38 PM1/10/19
to grpc.io
Hi Eric, 

Thanks for the reply, but I only enabled ping on client side, and only configured server to allow client sending pings, but the server is not configured to send pings.

Eric Anderson

unread,
Jan 15, 2019, 11:19:04 AM1/15/19
to Jin Yi, grpc.io
Oh, sorry. I wasn't paying attention enough to the screenshot. Those are TCP keepalives. Most discussion about keepalives in gRPC involves using HTTP/2 pings.

The netty server enables SO_KEEPALIVE, but leaves the settings at their defaults. In most cases the defaults are to send a TCP keepalive after 2 hours of inactivity. The server OS must be configured to use 1s keepalives by default, which seems very aggressive.

Reply all
Reply to author
Forward
0 new messages