From a5f3b6fd089d5214d64a0ab7bd1cffc17f61e7a3 Mon Sep 17 00:00:00 2001 From: Ben Buzbee Date: Wed, 30 Mar 2022 22:09:31 +0000 Subject: [PATCH 1/2] Use cleanhttp.DefaultPooledTransport The only difference is DefaultTransport sets DisableKeepAlives This doesn't make much sense to me - every http connection from the nomad client goes to the same NOMAD_ADDR so it's a great case for keep alive. Except round robin DNS and anycast perhaps. Consul does this already https://github.com/hashicorp/consul/blob/1e47e3c82b6eb937baab0688a67cf7ef334ce42c/api/api.go#L397 --- api/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/api.go b/api/api.go index 2dc00a3f69c..8e7c87106f5 100644 --- a/api/api.go +++ b/api/api.go @@ -264,7 +264,7 @@ func (t *TLSConfig) Copy() *TLSConfig { } func defaultHttpClient() *http.Client { - httpClient := cleanhttp.DefaultClient() + httpClient := cleanhttp.DefaultPooledClient() transport := httpClient.Transport.(*http.Transport) transport.TLSHandshakeTimeout = 10 * time.Second transport.TLSClientConfig = &tls.Config{ From b69cadb00f0243fa9f30f989b77ed8e9c7238a47 Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 6 Apr 2022 11:34:16 -0400 Subject: [PATCH 2/2] changelog entry --- .changelog/12409.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/12409.txt diff --git a/.changelog/12409.txt b/.changelog/12409.txt new file mode 100644 index 00000000000..98daac1af50 --- /dev/null +++ b/.changelog/12409.txt @@ -0,0 +1,3 @@ +```release-note:improvement +api: default to using DefaultPooledTransport client to support keep-alive by default +```