aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-05-22 22:49:09 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-05-22 22:49:09 +0200
commit3765f50c350ab4e5add37a971d4c544e928de47c (patch)
tree56db1d5bc2edd3407e2018a976486d64ae753e4a /config-model
parentd061f057a1e945b29114d90bfc02d7aa05ff619b (diff)
Set number of threads for summary compression to numcores/2.
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java12
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/search/NodeFlavorTuningTest.java21
2 files changed, 30 insertions, 3 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java
index 9259bd31018..20feab7dfd8 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java
@@ -4,6 +4,7 @@ import com.yahoo.config.provision.Flavor;
import com.yahoo.vespa.config.search.core.ProtonConfig;
import static java.lang.Long.min;
+import static java.lang.Integer.max;
/**
* Tuning of proton config for a search node based on the node flavor of that node.
@@ -23,7 +24,8 @@ public class NodeFlavorTuning implements ProtonConfig.Producer {
@Override
public void getConfig(ProtonConfig.Builder builder) {
tuneDiskWriteSpeed(builder);
- tuneDocumentStoreMaxFileSize(builder);
+ tuneDocumentStoreMaxFileSize(builder.summary.log);
+ tuneDocumentStoreNumThreads(builder.summary.log);
tuneFlushStrategyMemoryLimits(builder.flush.memory);
tuneFlushStrategyTlsSize(builder.flush.memory);
}
@@ -34,7 +36,7 @@ public class NodeFlavorTuning implements ProtonConfig.Producer {
}
}
- private void tuneDocumentStoreMaxFileSize(ProtonConfig.Builder builder) {
+ private void tuneDocumentStoreMaxFileSize(ProtonConfig.Summary.Log.Builder builder) {
double memoryGb = nodeFlavor.getMinMainMemoryAvailableGb();
long fileSizeBytes = 4 * GB;
if (memoryGb <= 12.0) {
@@ -44,7 +46,11 @@ public class NodeFlavorTuning implements ProtonConfig.Producer {
} else if (memoryGb <= 64.0) {
fileSizeBytes = 1 * GB;
}
- builder.summary.log.maxfilesize(fileSizeBytes);
+ builder.maxfilesize(fileSizeBytes);
+ }
+
+ private void tuneDocumentStoreNumThreads(ProtonConfig.Summary.Log.Builder builder) {
+ builder.numthreads(max(1, (int)nodeFlavor.getMinCpuCores()/2));
}
private void tuneFlushStrategyMemoryLimits(ProtonConfig.Flush.Memory.Builder builder) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeFlavorTuningTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeFlavorTuningTest.java
index b59f7c67abe..f5046194a0b 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/search/NodeFlavorTuningTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/search/NodeFlavorTuningTest.java
@@ -45,6 +45,19 @@ public class NodeFlavorTuningTest {
}
@Test
+ public void require_that_documentstore_numthreads_is_based_on_num_cores() {
+ assertDocumentStoreNumThreads(1, 0);
+ assertDocumentStoreNumThreads(1, 1.0);
+ assertDocumentStoreNumThreads(1, 3.0);
+ assertDocumentStoreNumThreads(2, 4.0);
+ assertDocumentStoreNumThreads(4, 8.0);
+ assertDocumentStoreNumThreads(12, 24.0);
+ assertDocumentStoreNumThreads(16, 32.0);
+ assertDocumentStoreNumThreads(24, 48.0);
+ assertDocumentStoreNumThreads(32, 64.0);
+ }
+
+ @Test
public void require_that_flush_strategy_memory_limits_are_set_based_on_available_memory() {
assertFlushStrategyMemory(512 * MB, 4);
assertFlushStrategyMemory(1 * GB, 8);
@@ -70,6 +83,10 @@ public class NodeFlavorTuningTest {
assertEquals(expMemoryBytes, configFromMemorySetting(memoryGb).flush().memory().each().maxmemory());
}
+ private static void assertDocumentStoreNumThreads(int numThreads, double numCores) {
+ assertEquals(numThreads, configFromNumCoresSetting(numCores).summary().log().numthreads());
+ }
+
private static void assertFlushStrategyTlsSize(long expTlsSizeBytes, int diskGb) {
assertEquals(expTlsSizeBytes, configFromDiskSetting(diskGb).flush().memory().maxtlssize());
}
@@ -89,6 +106,10 @@ public class NodeFlavorTuningTest {
minMainMemoryAvailableGb(memoryGb));
}
+ private static ProtonConfig configFromNumCoresSetting(double numCores) {
+ return getConfig(new FlavorsConfig.Flavor.Builder().minCpuCores(numCores));
+ }
+
private static ProtonConfig getConfig(FlavorsConfig.Flavor.Builder flavorBuilder) {
flavorBuilder.name("my_flavor");
NodeFlavorTuning tuning = new NodeFlavorTuning(new Flavor(new FlavorsConfig.Flavor(flavorBuilder)));