From 0f7ece84f32949c08caad367c7b2d10cbf2fcc3d Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 10 Apr 2021 17:35:45 +0300 Subject: [PATCH] app/vmstorage/transport: reduce memory allocations on data ingestion path --- app/vmstorage/transport/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/vmstorage/transport/server.go b/app/vmstorage/transport/server.go index 71ac623d4d..0543cd1f14 100644 --- a/app/vmstorage/transport/server.go +++ b/app/vmstorage/transport/server.go @@ -395,7 +395,7 @@ type unmarshalWork struct { } func (uw *unmarshalWork) reset() { - if (len(uw.mrs)*4 > cap(uw.mrs) || len(uw.reqBuf)*4 > cap(uw.reqBuf)) && fasttime.UnixTimestamp()-uw.lastResetTime > 10 { + if len(uw.reqBuf)*4 < cap(uw.reqBuf) && fasttime.UnixTimestamp()-uw.lastResetTime > 10 { // Periodically reset mrs and reqBuf in order to prevent from gradual memory usage growth // when ceratin entries in mr contain too long labels. // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/490 for details.