Tune tcp keep-alives with new kernel timeout options (#9963)

For more deeper understanding https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/
This commit is contained in:
Harshavardhana
2020-07-03 10:03:41 -07:00
committed by GitHub
parent 21a37e3393
commit e59ee14f40
8 changed files with 63 additions and 55 deletions

View File

@@ -454,7 +454,7 @@ func newCustomHTTPTransport(tlsConfig *tls.Config, dialTimeout time.Duration) fu
// https://golang.org/pkg/net/http/#Transport documentation
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: xhttp.NewCustomDialContext(dialTimeout, 15*time.Second),
DialContext: xhttp.NewCustomDialContext(dialTimeout),
MaxIdleConnsPerHost: 16,
MaxIdleConns: 16,
IdleConnTimeout: 1 * time.Minute,