From 37a5d5d7a0464f62c8b1e29969330e59d8281fb3 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 24 Sep 2020 20:10:07 -0700 Subject: [PATCH] reduce timeouts between servers for faster disconnects (#10562) --- cmd/lock-rest-client.go | 3 ++- cmd/peer-rest-client.go | 2 +- cmd/rest/client.go | 4 ++-- cmd/utils.go | 7 +++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/lock-rest-client.go b/cmd/lock-rest-client.go index 366b23d8b..6fe111f9e 100644 --- a/cmd/lock-rest-client.go +++ b/cmd/lock-rest-client.go @@ -23,6 +23,7 @@ import ( "errors" "io" "net/url" + "time" "github.com/minio/minio/cmd/http" xhttp "github.com/minio/minio/cmd/http" @@ -152,7 +153,7 @@ func newlockRESTClient(endpoint Endpoint) *lockRESTClient { } } - trFn := newInternodeHTTPTransport(tlsConfig, rest.DefaultRESTTimeout) + trFn := newInternodeHTTPTransport(tlsConfig, 10*time.Second) restClient := rest.NewClient(serverURL, trFn, newAuthToken) restClient.HealthCheckFn = func() bool { ctx, cancel := context.WithTimeout(GlobalContext, restClient.HealthCheckTimeout) diff --git a/cmd/peer-rest-client.go b/cmd/peer-rest-client.go index 13f7cc5af..1ce849fbe 100644 --- a/cmd/peer-rest-client.go +++ b/cmd/peer-rest-client.go @@ -883,7 +883,7 @@ func newPeerRESTClient(peer *xnet.Host) *peerRESTClient { } } - trFn := newInternodeHTTPTransport(tlsConfig, rest.DefaultRESTTimeout) + trFn := newInternodeHTTPTransport(tlsConfig, 10*time.Second) restClient := rest.NewClient(serverURL, trFn, newAuthToken) // Construct a new health function. diff --git a/cmd/rest/client.go b/cmd/rest/client.go index 6b91b5437..10602a0db 100644 --- a/cmd/rest/client.go +++ b/cmd/rest/client.go @@ -30,8 +30,8 @@ import ( xnet "github.com/minio/minio/pkg/net" ) -// DefaultRESTTimeout - default RPC timeout is one minute. -const DefaultRESTTimeout = 1 * time.Minute +// DefaultRESTTimeout - default RPC timeout is 15 seconds. +const DefaultRESTTimeout = 15 * time.Second const ( offline = iota diff --git a/cmd/utils.go b/cmd/utils.go index e99f9fd55..7b7d14006 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -470,11 +470,10 @@ func newInternodeHTTPTransport(tlsConfig *tls.Config, dialTimeout time.Duration) Proxy: http.ProxyFromEnvironment, DialContext: xhttp.NewInternodeDialContext(dialTimeout), MaxIdleConnsPerHost: 16, - MaxIdleConns: 16, - IdleConnTimeout: 1 * time.Minute, + IdleConnTimeout: 30 * time.Second, ResponseHeaderTimeout: 3 * time.Minute, // Set conservative timeouts for MinIO internode. - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 10 * time.Second, + TLSHandshakeTimeout: 15 * time.Second, + ExpectContinueTimeout: 15 * time.Second, TLSClientConfig: tlsConfig, // Go net/http automatically unzip if content-type is // gzip disable this feature, as we are always interested