lib/promscrape: reduce default value for -promscrape.discovery.concurrency from 500 to 100

This should reduce load on Kubernetes API server and Consul when big number of targets are discovered

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/574
This commit is contained in:
Aliaksandr Valialkin 2020-06-20 17:52:49 +03:00
parent 1f2826bae2
commit 62e1908986

View file

@ -17,7 +17,7 @@ import (
) )
var ( var (
maxConcurrency = flag.Int("promscrape.discovery.concurrency", 500, "The maximum number of concurrent requests to Prometheus autodiscovery API (Consul, Kubernetes, etc.)") maxConcurrency = flag.Int("promscrape.discovery.concurrency", 100, "The maximum number of concurrent requests to Prometheus autodiscovery API (Consul, Kubernetes, etc.)")
maxWaitTime = flag.Duration("promscrape.discovery.concurrentWaitTime", time.Minute, "The maximum duration for waiting to perform API requests "+ maxWaitTime = flag.Duration("promscrape.discovery.concurrentWaitTime", time.Minute, "The maximum duration for waiting to perform API requests "+
"if more than -promscrape.discovery.concurrency requests are simultaneously performed") "if more than -promscrape.discovery.concurrency requests are simultaneously performed")
) )
@ -65,7 +65,7 @@ func NewClient(apiServer string, ac *promauth.Config) (*Client, error) {
ReadTimeout: time.Minute, ReadTimeout: time.Minute,
WriteTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second,
MaxResponseBodySize: 300 * 1024 * 1024, MaxResponseBodySize: 300 * 1024 * 1024,
MaxConns: *maxConcurrency, MaxConns: 2 * *maxConcurrency,
} }
return &Client{ return &Client{
hc: hc, hc: hc,