From aaaea24732568949f9713b6b61fa3135571e24ce Mon Sep 17 00:00:00 2001 From: JohnnyThree Date: Mon, 16 Mar 2020 10:37:06 +0800 Subject: [PATCH] 1.set grpc_keepalive_time to 10 seconds 2.set grpc_keepalive_timeout to 10 seconds These settings will help to avoid the situation which query will hang there when pod or Bare metal is broken. Signed-off-by: JohnnyThree --- go/vt/grpcclient/client.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go/vt/grpcclient/client.go b/go/vt/grpcclient/client.go index 2dae863a9a9..f2fd3e40ddf 100644 --- a/go/vt/grpcclient/client.go +++ b/go/vt/grpcclient/client.go @@ -20,6 +20,7 @@ package grpcclient import ( "flag" + "time" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" @@ -35,8 +36,8 @@ import ( ) var ( - keepaliveTime = flag.Duration("grpc_keepalive_time", 0, "After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive.") - keepaliveTimeout = flag.Duration("grpc_keepalive_timeout", 0, "After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.") + keepaliveTime = flag.Duration("grpc_keepalive_time", 10*time.Second, "After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive.") + keepaliveTimeout = flag.Duration("grpc_keepalive_timeout", 10*time.Second, "After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.") initialConnWindowSize = flag.Int("grpc_initial_conn_window_size", 0, "grpc initial connection window size") initialWindowSize = flag.Int("grpc_initial_window_size", 0, "grpc initial window size") )