summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-11-15 23:55:14 +0100
committerGitHub <noreply@github.com>2022-11-15 23:55:14 +0100
commit09f650d7bd05b13b1f5600b711872e443e645f25 (patch)
tree5875d9b435263d744e711b29cba8f279a7858d1e
parent8f5d1b2b77cb79f86d07cba8bf85b858d3f258f8 (diff)
parent07b0309d59f46590dbce87076e1393aaaa9bab07 (diff)
Merge pull request #24875 from vespa-engine/balder/reduce-number-of-flush-threads
- If less than 16G memory only use single flush thread.
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java5
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/NodeResourcesTuningTest.java9
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..0cf361c10dd 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_THREAD_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_THREAD_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) {