diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-15 16:20:59 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-11-15 16:20:59 +0100 |
commit | afa904a588acbca603b3f6e958451026902cb5d6 (patch) | |
tree | 301ba90adf2d6f203300ef818120573bc5bcd1c3 | |
parent | 6aa28bef33083a3d5c1a4a1ad8b1becbc26bcf12 (diff) |
- If less than 16G memory only use single flush thread.
- No more than 1 flushtread per 8 vcpus.
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java | 5 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java | 9 |
2 files changed, 11 insertions, 3 deletions
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 bc5de959f3f..35211a6a45d 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 @@ -17,7 +17,8 @@ public class NodeResourcesTuning implements ProtonConfig.Producer { 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.04; private final static double MEMORY_GAIN_AS_FRACTION_OF_MEMORY = 0.08; - private final static double MIN_MEMORY_PER_FLUSH_THREAD_GB = 12.0; + private final static double MIN_MEMORY_PER_FLUSH_THREAD_GB = 16.0; + private final static double MAX_FLUSH_TREAD_RATIO = 1.0/8; private final static double TLS_SIZE_FRACTION = 0.02; final static long MB = 1024 * 1024; public final static long GB = MB * 1024; @@ -96,6 +97,8 @@ public class NodeResourcesTuning implements ProtonConfig.Producer { if (usableMemoryGb() < MIN_MEMORY_PER_FLUSH_THREAD_GB) { builder.maxconcurrent(1); } + builder.maxconcurrent(Math.min(builder.build().maxconcurrent(), + Math.max(1, (int)Math.ceil(resources.vcpu()*MAX_FLUSH_TREAD_RATIO)))); } private void tuneFlushStrategyTlsSize(ProtonConfig.Flush.Memory.Builder builder) { 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 861482ab70c..d0fa205237e 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 @@ -168,10 +168,15 @@ public class NodeResourcesTuningTest { assertSharedDisk(true, true); } + private static ProtonConfig fromMemAndCpu(int gb, int vcpu) { + return getConfig(new FlavorsConfig.Flavor.Builder().minMainMemoryAvailableGb(gb).minCpuCores(vcpu)); + } @Test public void require_that_concurrent_flush_threads_is_1_with_low_memory() { - assertEquals(2, configFromMemorySetting(13, 0).flush().maxconcurrent()); - assertEquals(1, configFromMemorySetting(11, 0).flush().maxconcurrent()); + assertEquals(2, fromMemAndCpu(17, 9).flush().maxconcurrent()); + assertEquals(1, fromMemAndCpu(15, 8).flush().maxconcurrent()); + assertEquals(1, fromMemAndCpu(17, 8).flush().maxconcurrent()); + assertEquals(1, fromMemAndCpu(15, 8).flush().maxconcurrent()); } private static void assertDocumentStoreMaxFileSize(long expFileSizeBytes, int wantedMemoryGb) { |