From cda38c8070cb7ad2b44c39f21debe947e22a7c9d Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 27 Aug 2019 08:29:07 -0400 Subject: [PATCH] hsbench: Limit idle connections to 2x the thread count. Signed-off-by: Mark Nelson --- hsbench.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hsbench.go b/hsbench.go index 44c04bd..bb7c24e 100644 --- a/hsbench.go +++ b/hsbench.go @@ -54,10 +54,10 @@ var HTTPTransport http.RoundTripper = &http.Transport{ }).Dial, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 0, - // Allow an unlimited number of idle connections - MaxIdleConnsPerHost: 4096, - MaxIdleConns: 0, - // But limit their idle time + // Set the number of idle connections to 2X the number of threads + MaxIdleConnsPerHost: 2*threads, + MaxIdleConns: 2*threads, + // But limit their idle time to 1 minute IdleConnTimeout: time.Minute, // Ignore TLS errors TLSClientConfig: &tls.Config{InsecureSkipVerify: true},