From 2ef5caa5ede13d92975a99915c8d58be338293dc Mon Sep 17 00:00:00 2001 From: smruthi2187 <34555664+smruthi2187@users.noreply.github.com> Date: Fri, 6 Apr 2018 13:23:25 -0700 Subject: [PATCH] Prevent releasing idle connections because transport is shared. (#609) The transport in RoundTripper is the default transport and there's just one object shared between different http requests and releasing the idle Connections ended up releasing the idle connections that were established with the executor service address too. So every time a http request was made to get a service for function, the transport layer ended up having to dial a new connection (that was timing out due to various reasons). By removing the CloseIdleConnections, we minimize the need for transport to dial a new connection to executor for every request, thereby minimizing the occurrence of dial timeouts. --- router/functionHandler.go | 1 - 1 file changed, 1 deletion(-) diff --git a/router/functionHandler.go b/router/functionHandler.go index 271f49fbd..0fb221d1d 100644 --- a/router/functionHandler.go +++ b/router/functionHandler.go @@ -78,7 +78,6 @@ func (roundTripper RetryingRoundTripper) RoundTrip(req *http.Request) (resp *htt // set the timeout for transport context timeout := roundTripper.initialTimeout transport := http.DefaultTransport.(*http.Transport) - defer transport.CloseIdleConnections() // cache lookup to get serviceUrl serviceUrl, err = roundTripper.funcHandler.fmap.lookup(roundTripper.funcHandler.function)