diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-10-06 15:41:14 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-10-06 15:41:14 +0200 |
commit | a0c814fafbedba6edc8e730dfca1363623bf3437 (patch) | |
tree | 0d56d90dac1d82766259328c944bf870af3142cd /config-model | |
parent | cb60fccb0fb3bf92bf2a223324dad44e986ae54d (diff) |
summary.log.numthreads -> background.threads.
Diffstat (limited to 'config-model')
6 files changed, 44 insertions, 4 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java index ba89169fc4c..4ea638ca41a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilder.java @@ -74,6 +74,8 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui handleSummary(parent, e, t.searchNode); } else if (equals("initialize", e)) { handleInitialize(e, t.searchNode); + } else if (equals("background", e)) { + handleBackground(e, t.searchNode); } } } @@ -251,6 +253,9 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui } else if (equals("minfilesizefactor", e)) { s.logStore.minFileSizeFactor = asDouble(e); } else if (equals("numthreads", e)) { + parent.deployLogger().log(Level.WARNING, + "Element 'numthreads is deprecated. Use background.threads instead." + + " For now it will take max of the two."); s.logStore.numThreads = asInt(e); } else if (equals("chunk", e)) { s.logStore.chunk = new Tuning.SearchNode.Summary.Store.Component(true); @@ -268,4 +273,13 @@ public class DomSearchTuningBuilder extends VespaDomBuilder.DomConfigProducerBui } } + private void handleBackground(Element spec, Tuning.SearchNode sn) { + sn.background = new Tuning.SearchNode.Background(); + for (Element e : XML.getChildren(spec)) { + if (equals("threads", e)) { + sn.background.threads = asInt(e); + } + } + } + } 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 5750db08178..6cfd52cc232 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 @@ -27,7 +27,7 @@ public class NodeFlavorTuning implements ProtonConfig.Producer { setHwInfo(builder); tuneDiskWriteSpeed(builder); tuneDocumentStoreMaxFileSize(builder.summary.log); - tuneDocumentStoreNumThreads(builder.summary.log); + tuneDocumentStoreNumThreads(builder.background); tuneFlushStrategyMemoryLimits(builder.flush.memory); tuneFlushStrategyTlsSize(builder.flush.memory); } @@ -56,8 +56,8 @@ public class NodeFlavorTuning implements ProtonConfig.Producer { builder.maxfilesize(fileSizeBytes); } - private void tuneDocumentStoreNumThreads(ProtonConfig.Summary.Log.Builder builder) { - builder.numthreads(max(8, (int)nodeFlavor.getMinCpuCores()/2)); + private void tuneDocumentStoreNumThreads(ProtonConfig.Background.Builder builder) { + builder.threads(max(8, (int)nodeFlavor.getMinCpuCores()/2)); } private void tuneFlushStrategyMemoryLimits(ProtonConfig.Flush.Memory.Builder builder) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java index 17af4030cb6..1e3b1783f9b 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java @@ -334,6 +334,17 @@ public class Tuning extends AbstractConfigProducer implements PartitionsConfig.P } } + public static class Background implements ProtonConfig.Producer { + public Integer threads = null; + + @Override + public void getConfig(ProtonConfig.Builder builder) { + if (threads != null) { + builder.background.threads(threads); + } + } + } + public RequestThreads threads = null; public FlushStrategy strategy = null; public Resizing resizing = null; @@ -341,6 +352,7 @@ public class Tuning extends AbstractConfigProducer implements PartitionsConfig.P public Attribute attribute = null; public Summary summary = null; public Initialize initialize = null; + public Background background = null; @Override public void getConfig(ProtonConfig.Builder builder) { @@ -351,6 +363,7 @@ public class Tuning extends AbstractConfigProducer implements PartitionsConfig.P if (attribute != null) attribute.getConfig(builder); if (summary != null) summary.getConfig(builder); if (initialize != null) initialize.getConfig(builder); + if (background != null) background.getConfig(builder); } } diff --git a/config-model/src/main/resources/schema/content.rnc b/config-model/src/main/resources/schema/content.rnc index 9031e8128df..e75c15ea524 100644 --- a/config-model/src/main/resources/schema/content.rnc +++ b/config-model/src/main/resources/schema/content.rnc @@ -353,6 +353,9 @@ Tuning = element tuning { }? & element initialize { element threads { xsd:nonNegativeInteger }? + }? & + element background { + element threads { xsd:nonNegativeInteger }? }? }? } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilderTest.java index 613827d2cf1..210334a1f23 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/DomSearchTuningBuilderTest.java @@ -233,4 +233,14 @@ public class DomSearchTuningBuilderTest extends DomBuilderTest { assertThat(cfg, containsString("initialize.threads 7")); } + @Test + public void requireThatWeCanParseBackgroundTag() { + Tuning t = createTuning(parseXml("<background>", + "<threads>7</threads>", + "</background>")); + assertEquals(7, t.searchNode.background.threads.intValue()); + String cfg = getProtonCfg(t); + assertThat(cfg, containsString("background.threads 7")); + } + } 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 0e1ad92c70d..75f6abb2542 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 @@ -97,7 +97,7 @@ public class NodeFlavorTuningTest { } private static void assertDocumentStoreNumThreads(int numThreads, double numCores) { - assertEquals(numThreads, configFromNumCoresSetting(numCores).summary().log().numthreads()); + assertEquals(numThreads, configFromNumCoresSetting(numCores).background().threads()); } private static void assertFlushStrategyTlsSize(long expTlsSizeBytes, int diskGb) { |