From ede93469ea705d5a5b1565c05bb29a4c60501b57 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 21 Jan 2022 12:45:29 +0200 Subject: [PATCH] lib/mergeset: tune caches size limits for `indexdb/dataBlocks` and `indexdb/indexBlocks` Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2007 --- lib/mergeset/part.go | 4 ++-- lib/storage/part.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/mergeset/part.go b/lib/mergeset/part.go index 356c6878e..d49e19ee3 100644 --- a/lib/mergeset/part.go +++ b/lib/mergeset/part.go @@ -17,7 +17,7 @@ var ibCache = blockcache.NewCache(getMaxInmemoryBlocksCacheSize) func getMaxIndexBlocksCacheSize() int { maxIndexBlockCacheSizeOnce.Do(func() { - maxIndexBlockCacheSize = memory.Allowed() / 10 + maxIndexBlockCacheSize = int(0.2 * float64(memory.Allowed())) }) return maxIndexBlockCacheSize } @@ -29,7 +29,7 @@ var ( func getMaxInmemoryBlocksCacheSize() int { maxInmemoryBlockCacheSizeOnce.Do(func() { - maxInmemoryBlockCacheSize = memory.Allowed() / 4 + maxInmemoryBlockCacheSize = int(0.3 * float64(memory.Allowed())) }) return maxInmemoryBlockCacheSize } diff --git a/lib/storage/part.go b/lib/storage/part.go index fb1befd68..956ab7bae 100644 --- a/lib/storage/part.go +++ b/lib/storage/part.go @@ -16,7 +16,7 @@ var ibCache = blockcache.NewCache(getMaxIndexBlocksCacheSize) func getMaxIndexBlocksCacheSize() int { maxIndexBlockCacheSizeOnce.Do(func() { - maxIndexBlockCacheSize = memory.Allowed() / 10 + maxIndexBlockCacheSize = int(0.1 * float64(memory.Allowed())) }) return maxIndexBlockCacheSize }