From c94823f52c7dbcbc2f9ffc887bcafe0f29ed572d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 4 Apr 2019 20:28:40 -0700 Subject: [PATCH] set default http idle connection per host possible fix https://github.com/chrislusf/seaweedfs/issues/915 --- weed/util/grpc_client_server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/util/grpc_client_server.go b/weed/util/grpc_client_server.go index e5993aeab..5c08538dc 100644 --- a/weed/util/grpc_client_server.go +++ b/weed/util/grpc_client_server.go @@ -3,6 +3,7 @@ package util import ( "context" "fmt" + "net/http" "strconv" "strings" "sync" @@ -18,6 +19,10 @@ var ( grpcClientsLock sync.Mutex ) +func init(){ + http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 100 +} + func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server { var options []grpc.ServerOption options = append(options, grpc.KeepaliveParams(keepalive.ServerParameters{