From a93046023605b0edd9a5d5d91c9f59b2cff60ebb Mon Sep 17 00:00:00 2001
From: Aliaksandr Valialkin <valyala@gmail.com>
Date: Tue, 4 Aug 2020 20:59:55 +0300
Subject: [PATCH] app/vmagent: tune http client for sending data to remote
 storage in order to disable closing keep-alive connections

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/663
---
 app/vmagent/remotewrite/client.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/vmagent/remotewrite/client.go b/app/vmagent/remotewrite/client.go
index b33c20f603..0a88326bb9 100644
--- a/app/vmagent/remotewrite/client.go
+++ b/app/vmagent/remotewrite/client.go
@@ -69,7 +69,9 @@ func newClient(argIdx int, remoteWriteURL, urlLabelValue string, fq *persistentq
 		TLSClientConfig:     tlsCfg,
 		TLSHandshakeTimeout: 5 * time.Second,
 		MaxConnsPerHost:     2 * concurrency,
-		WriteBufferSize:     16 * 1024,
+		MaxIdleConnsPerHost: 2 * concurrency,
+		IdleConnTimeout:     time.Minute,
+		WriteBufferSize:     64 * 1024,
 	}
 	pURL := proxyURL.GetOptionalArg(argIdx)
 	if len(pURL) > 0 {