From 487e435679d6c8cc153b8ef048b8957478cd3d0c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 12 Feb 2021 03:47:15 -0800 Subject: [PATCH] adjust http max idle connections per host related to https://github.com/chrislusf/seaweedfs/issues/1802 --- .../bench_filer_upload/bench_filer_upload.go | 2 +- weed/operation/upload_content.go | 1 + weed/pb/grpc_client_server.go | 1 + weed/s3api/s3api_object_handlers.go | 1 + weed/server/filer_server_handlers_proxy.go | 1 + weed/util/http_util.go | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/unmaintained/stress_filer_upload/bench_filer_upload/bench_filer_upload.go b/unmaintained/stress_filer_upload/bench_filer_upload/bench_filer_upload.go index b2e4b28c6..2ee8028f2 100644 --- a/unmaintained/stress_filer_upload/bench_filer_upload/bench_filer_upload.go +++ b/unmaintained/stress_filer_upload/bench_filer_upload/bench_filer_upload.go @@ -45,7 +45,7 @@ func main() { defer wg.Done() client := &http.Client{Transport: &http.Transport{ - MaxConnsPerHost: 1024, + MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, }} r := rand.New(rand.NewSource(time.Now().UnixNano() + int64(x))) diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index fccc24b16..7e2a6dcd2 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -58,6 +58,7 @@ var ( func init() { HttpClient = &http.Client{Transport: &http.Transport{ + MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, }} } diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go index 9ffda9b04..ec49d177b 100644 --- a/weed/pb/grpc_client_server.go +++ b/weed/pb/grpc_client_server.go @@ -29,6 +29,7 @@ var ( func init() { http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 1024 + http.DefaultTransport.(*http.Transport).MaxIdleConns = 1024 } func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server { diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index 4c408110a..82f0de6b2 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -27,6 +27,7 @@ var ( func init() { client = &http.Client{Transport: &http.Transport{ + MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, }} } diff --git a/weed/server/filer_server_handlers_proxy.go b/weed/server/filer_server_handlers_proxy.go index 8d73bc960..b8b28790b 100644 --- a/weed/server/filer_server_handlers_proxy.go +++ b/weed/server/filer_server_handlers_proxy.go @@ -14,6 +14,7 @@ var ( func init() { client = &http.Client{Transport: &http.Transport{ + MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, }} } diff --git a/weed/util/http_util.go b/weed/util/http_util.go index 2cd69b01b..135d10c45 100644 --- a/weed/util/http_util.go +++ b/weed/util/http_util.go @@ -21,6 +21,7 @@ var ( func init() { Transport = &http.Transport{ + MaxIdleConns: 1024, MaxIdleConnsPerHost: 1024, } client = &http.Client{