mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
Adjust http.Transport.MaxIdleConns
setting for vmauth/vmalert services (#1704)
* vmalert: adjust `http.Transport.MaxIdleConns` value accordingly to `http.Transport.MaxIdleConnsPerHost` `http.Transport.MaxIdleConnsPerHost` setting is controlled by `datasource.maxIdleConnections` flag, while `http.Transport.MaxIdleConns` is inherited from DefaultTransport and is equal to `100`. The fix adjusts `http.Transport.MaxIdleConns` value if it is lower than `http.Transport.MaxIdleConnsPerHost`. Signed-off-by: hagen1778 <roman@victoriametrics.com> * vmauth: adjust `http.Transport.MaxIdleConns` value accordingly to `http.Transport.MaxIdleConnsPerHost` `http.Transport.MaxIdleConnsPerHost` setting is controlled by `maxIdleConnsPerBackend` flag, while `http.Transport.MaxIdleConns` is inherited from DefaultTransport and is equal to `100`. The fix adjusts `http.Transport.MaxIdleConns` value if it is lower than `http.Transport.MaxIdleConnsPerHost`. Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
1c17fe70e0
commit
7fcbd3fa4b
@ -52,6 +52,9 @@ func Init(extraParams []Param) (QuerierBuilder, error) {
|
||||
return nil, fmt.Errorf("failed to create transport: %w", err)
|
||||
}
|
||||
tr.MaxIdleConnsPerHost = *maxIdleConnections
|
||||
if tr.MaxIdleConns != 0 && tr.MaxIdleConns < tr.MaxIdleConnsPerHost {
|
||||
tr.MaxIdleConns = tr.MaxIdleConnsPerHost
|
||||
}
|
||||
|
||||
if *roundDigits > 0 {
|
||||
extraParams = append(extraParams, Param{
|
||||
|
@ -130,6 +130,9 @@ var reverseProxy = &httputil.ReverseProxy{
|
||||
// Disable HTTP/2.0, since VictoriaMetrics components don't support HTTP/2.0 (because there is no sense in this).
|
||||
tr.ForceAttemptHTTP2 = false
|
||||
tr.MaxIdleConnsPerHost = *maxIdleConnsPerBackend
|
||||
if tr.MaxIdleConns != 0 && tr.MaxIdleConns < tr.MaxIdleConnsPerHost {
|
||||
tr.MaxIdleConns = tr.MaxIdleConnsPerHost
|
||||
}
|
||||
return tr
|
||||
}(),
|
||||
FlushInterval: time.Second,
|
||||
|
Loading…
Reference in New Issue
Block a user