aboutsummaryrefslogtreecommitdiff
path: root/weed/util/grpc_client_server.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-04-04 20:28:40 -0700
committerChris Lu <chris.lu@gmail.com>2019-04-04 20:28:40 -0700
commitc94823f52c7dbcbc2f9ffc887bcafe0f29ed572d (patch)
tree7e929a14b5e898201900e423591f82cfa074f859 /weed/util/grpc_client_server.go
parent0bd7ced7c248d76c0e0c87728ebca5308e7d51c6 (diff)
downloadseaweedfs-c94823f52c7dbcbc2f9ffc887bcafe0f29ed572d.tar.xz
seaweedfs-c94823f52c7dbcbc2f9ffc887bcafe0f29ed572d.zip
set default http idle connection per host
possible fix https://github.com/chrislusf/seaweedfs/issues/915
Diffstat (limited to 'weed/util/grpc_client_server.go')
-rw-r--r--weed/util/grpc_client_server.go5
1 files changed, 5 insertions, 0 deletions
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{