From 2aa6508c287c941ebc3555764f3893b49f216a82 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 4 Jan 2022 22:42:59 +0100 Subject: Let max summary filesize be 2% of available memory instead of an ancient staircase, that only fits the perfect the ones with a perfect BMI anyway. --- .../yahoo/vespa/model/search/NodeResourcesTuning.java | 19 ++++++------------- .../vespa/model/search/NodeResourcesTuningTest.java | 16 ++++++++-------- 2 files changed, 14 insertions(+), 21 deletions(-) (limited to 'config-model') diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java index 4d03733de51..0eb0bd0bf2d 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java @@ -14,8 +14,9 @@ import static java.lang.Long.max; */ public class NodeResourcesTuning implements ProtonConfig.Producer { - private final static double SUMMARY_CACHE_SIZE_FRACTION_OF_MEMORY = 0.05; - private final static double MEMORY_GAIN_FRACTION_OF_MEMORY = 0.10; + private final static double SUMMARY_FILE_SIZE_AS_FRACTION_OF_MEMORY = 0.02; + private final static double SUMMARY_CACHE_SIZE_AS_FRACTION_OF_MEMORY = 0.05; + private final static double MEMORY_GAIN_AS_FRACTION_OF_MEMORY = 0.10; final static long MB = 1024 * 1024; public final static long GB = MB * 1024; // This is an approximate number base on observation of a node using 33G memory with 765M docs @@ -63,7 +64,7 @@ public class NodeResourcesTuning implements ProtonConfig.Producer { } private void tuneSummaryCache(ProtonConfig.Summary.Cache.Builder builder) { - long memoryLimitBytes = (long) ((usableMemoryGb() * SUMMARY_CACHE_SIZE_FRACTION_OF_MEMORY) * GB); + long memoryLimitBytes = (long) ((usableMemoryGb() * SUMMARY_CACHE_SIZE_AS_FRACTION_OF_MEMORY) * GB); builder.maxbytes(memoryLimitBytes); } @@ -81,20 +82,12 @@ public class NodeResourcesTuning implements ProtonConfig.Producer { } private void tuneDocumentStoreMaxFileSize(ProtonConfig.Summary.Log.Builder builder) { - double memoryGb = usableMemoryGb(); - long fileSizeBytes = 4 * GB; - if (memoryGb <= 12.0) { - fileSizeBytes = 256 * MB; - } else if (memoryGb < 24.0) { - fileSizeBytes = 512 * MB; - } else if (memoryGb <= 64.0) { - fileSizeBytes = 1 * GB; - } + long fileSizeBytes = (long) Math.max(256*MB, usableMemoryGb()*GB*SUMMARY_FILE_SIZE_AS_FRACTION_OF_MEMORY); builder.maxfilesize(fileSizeBytes); } private void tuneFlushStrategyMemoryLimits(ProtonConfig.Flush.Memory.Builder builder) { - long memoryLimitBytes = (long) ((usableMemoryGb() * MEMORY_GAIN_FRACTION_OF_MEMORY) * GB); + long memoryLimitBytes = (long) ((usableMemoryGb() * MEMORY_GAIN_AS_FRACTION_OF_MEMORY) * GB); builder.maxmemory(memoryLimitBytes); builder.each.maxmemory(memoryLimitBytes); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java index ff2ef5bd214..9a6a7458766 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java @@ -113,14 +113,14 @@ public class NodeResourcesTuningTest { assertDocumentStoreMaxFileSize(256 * MB, 6); assertDocumentStoreMaxFileSize(256 * MB, 8); assertDocumentStoreMaxFileSize(256 * MB, 12); - assertDocumentStoreMaxFileSize(512 * MB, 16); - assertDocumentStoreMaxFileSize(1 * GB, 24); - assertDocumentStoreMaxFileSize(1 * GB, 32); - assertDocumentStoreMaxFileSize(1 * GB, 48); - assertDocumentStoreMaxFileSize(1 * GB, 64); - assertDocumentStoreMaxFileSize(4 * GB, 128); - assertDocumentStoreMaxFileSize(4 * GB, 256); - assertDocumentStoreMaxFileSize(4 * GB, 512); + assertDocumentStoreMaxFileSize((long)(16*GB*0.02), 16); + assertDocumentStoreMaxFileSize((long)(24*GB*0.02), 24); + assertDocumentStoreMaxFileSize((long)(32*GB*0.02), 32); + assertDocumentStoreMaxFileSize((long)(48*GB*0.02), 48); + assertDocumentStoreMaxFileSize((long)(64*GB*0.02), 64); + assertDocumentStoreMaxFileSize((long)(128*GB*0.02), 128); + assertDocumentStoreMaxFileSize((long)(256*GB*0.02), 256); + assertDocumentStoreMaxFileSize((long)(512*GB*0.02), 512); } @Test -- cgit v1.2.3