mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Set MaxIdleConnsPerHost alongside MaxIdleConns (#3592)
Otherwise it defaults to 2, and Go will close extra connections as soon as a request is finished. See https://github.com/golang/go/issues/13801
This commit is contained in:
parent
9083d41d3a
commit
a8cce41882
|
@ -41,11 +41,12 @@ func NewClientFromConfig(cfg config.HTTPClientConfig, name string) (*http.Client
|
||||||
// The only timeout we care about is the configured scrape timeout.
|
// The only timeout we care about is the configured scrape timeout.
|
||||||
// It is applied on request. So we leave out any timings here.
|
// It is applied on request. So we leave out any timings here.
|
||||||
var rt http.RoundTripper = &http.Transport{
|
var rt http.RoundTripper = &http.Transport{
|
||||||
Proxy: http.ProxyURL(cfg.ProxyURL.URL),
|
Proxy: http.ProxyURL(cfg.ProxyURL.URL),
|
||||||
MaxIdleConns: 20000,
|
MaxIdleConns: 20000,
|
||||||
DisableKeepAlives: false,
|
MaxIdleConnsPerHost: 1000, // see https://github.com/golang/go/issues/13801
|
||||||
TLSClientConfig: tlsConfig,
|
DisableKeepAlives: false,
|
||||||
DisableCompression: true,
|
TLSClientConfig: tlsConfig,
|
||||||
|
DisableCompression: true,
|
||||||
// 5 minutes is typically above the maximum sane scrape interval. So we can
|
// 5 minutes is typically above the maximum sane scrape interval. So we can
|
||||||
// use keepalive for all configurations.
|
// use keepalive for all configurations.
|
||||||
IdleConnTimeout: 5 * time.Minute,
|
IdleConnTimeout: 5 * time.Minute,
|
||||||
|
|
Loading…
Reference in a new issue