From e702b7a92f897a32bfce2a69b522f7c140c4ad3f Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 5 Nov 2021 15:14:49 +0200 Subject: [PATCH] app/vmagent: allow bigger number of in-memory blocks for big values of `-remoteWrite.queues` This should improve the maximum data ingestion speed for highly-loaded vmagent instances which run on beefy servers with many CPU cores and big amounts of RAM --- app/vmagent/remotewrite/remotewrite.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/vmagent/remotewrite/remotewrite.go b/app/vmagent/remotewrite/remotewrite.go index 96a3073cc2..f8d1805db8 100644 --- a/app/vmagent/remotewrite/remotewrite.go +++ b/app/vmagent/remotewrite/remotewrite.go @@ -172,11 +172,11 @@ func newRemoteWriteCtxs(at *auth.Token, urls []string) []*remoteWriteCtx { } maxInmemoryBlocks := memory.Allowed() / len(urls) / *maxRowsPerBlock / 100 - if maxInmemoryBlocks > 400 { + if maxInmemoryBlocks / *queues > 100 { // There is no much sense in keeping higher number of blocks in memory, // since this means that the producer outperforms consumer and the queue // will continue growing. It is better storing the queue to file. - maxInmemoryBlocks = 400 + maxInmemoryBlocks = 100 * *queues } if maxInmemoryBlocks < 2 { maxInmemoryBlocks = 2