aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-09-14 15:44:21 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-09-14 15:57:00 +0200
commit7987a90002395bcb4c98cb2991c79832f3e0c5e6 (patch)
tree4c88be9f25b8c46df2e7e70645b6bfb58dcfba79 /config-model/src
parent80e847614e1233ce526f442b0104bc0c96c67349 (diff)
Change feature flag to no longer control the default threadpool
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java26
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java14
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java50
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java16
4 files changed, 5 insertions, 101 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java
index 5207a0163cb..232552ea4ce 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java
@@ -3,8 +3,8 @@ package com.yahoo.vespa.model.container;
import com.yahoo.config.model.api.container.ContainerServiceType;
import com.yahoo.config.model.producer.AbstractConfigProducer;
+import com.yahoo.config.provision.NodeResources;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
-import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.prelude.fastsearch.FS4ResourcePool;
import com.yahoo.search.config.QrStartConfig;
@@ -15,10 +15,7 @@ import com.yahoo.vespa.model.container.component.Component;
*
* @author gjoranv
*/
-public final class ApplicationContainer extends Container implements
- QrStartConfig.Producer,
- ThreadpoolConfig.Producer
-{
+public final class ApplicationContainer extends Container implements QrStartConfig.Producer {
private static final String defaultHostedJVMArgs = "-XX:+UseOSErrorReporting -XX:+SuppressFatalErrorMessage";
@@ -44,9 +41,9 @@ public final class ApplicationContainer extends Container implements
@Override
public void getConfig(QrStartConfig.Builder builder) {
if (getHostResource() != null) {
- if ( ! getHostResource().realResources().isUnspecified()) {
- NodeResourcesTuning flavorTuning = new NodeResourcesTuning(getHostResource().realResources());
- flavorTuning.getConfig(builder);
+ NodeResources nodeResources = getHostResource().realResources();
+ if ( ! nodeResources.isUnspecified()) {
+ builder.jvm.availableProcessors(Math.max(2, (int)Math.ceil(nodeResources.vcpu())));
}
}
}
@@ -75,17 +72,4 @@ public final class ApplicationContainer extends Container implements
private boolean hasDocproc() {
return (parent instanceof ContainerCluster) && (((ContainerCluster)parent).getDocproc() != null);
}
-
- @Override
- public void getConfig(ThreadpoolConfig.Builder builder) {
- if (! (parent instanceof ContainerCluster)) return;
- if ((getHostResource() == null) || getHostResource().realResources().isUnspecified()) return;
- ContainerCluster containerCluster = (ContainerCluster) parent;
- if (containerCluster.getThreadPoolSizeFactor() <= 0.0) return;
-
- NodeResourcesTuning resourcesTuning = new NodeResourcesTuning(getHostResource().realResources())
- .setThreadPoolSizeFactor(containerCluster.getThreadPoolSizeFactor())
- .setQueueSizeFactor(containerCluster.getQueueSizeFactor());
- resourcesTuning.getConfig(builder);
- }
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
index 6d8f3056cef..87e8f16f88c 100755
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java
@@ -160,17 +160,11 @@ public abstract class ContainerCluster<CONTAINER extends Container>
private String jvmGCOptions = null;
private String environmentVars = null;
- private final double threadPoolSizeFactor;
- private final double queueSizeFactor;
-
-
public ContainerCluster(AbstractConfigProducer<?> parent, String subId, String name, DeployState deployState) {
super(parent, subId);
this.name = name;
this.isHostedVespa = stateIsHosted(deployState);
this.zone = (deployState != null) ? deployState.zone() : Zone.defaultZone();
- this.threadPoolSizeFactor = deployState.getProperties().threadPoolSizeFactor();
- this.queueSizeFactor = deployState.getProperties().queueSizeFactor();
componentGroup = new ComponentGroup<>(this, "component");
@@ -192,14 +186,6 @@ public abstract class ContainerCluster<CONTAINER extends Container>
addJaxProviders();
}
- public double getThreadPoolSizeFactor() {
- return threadPoolSizeFactor;
- }
-
- public double getQueueSizeFactor() {
- return queueSizeFactor;
- }
-
public void setZone(Zone zone) {
this.zone = zone;
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java
deleted file mode 100644
index 7eb7a1fb518..00000000000
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.model.container;
-
-import com.yahoo.config.provision.NodeResources;
-import com.yahoo.container.handler.ThreadpoolConfig;
-import com.yahoo.search.config.QrStartConfig;
-
-/**
- * Tuning of qr-start config for a container service based on node resources.
- *
- * @author balder
- */
-public class NodeResourcesTuning implements QrStartConfig.Producer, ThreadpoolConfig.Producer {
-
- private final NodeResources resources;
-
- public NodeResourcesTuning setThreadPoolSizeFactor(double threadPoolSizeFactor) {
- this.threadPoolSizeFactor = threadPoolSizeFactor;
- return this;
- }
-
- public NodeResourcesTuning setQueueSizeFactor(double queueSizeFactor) {
- this.queueSizeFactor = queueSizeFactor;
- return this;
- }
-
- private double threadPoolSizeFactor = 8.0;
- private double queueSizeFactor = 8.0;
-
- NodeResourcesTuning(NodeResources resources) {
- this.resources = resources;
- }
-
- @Override
- public void getConfig(QrStartConfig.Builder builder) {
- builder.jvm.availableProcessors(Math.max(2, (int)Math.ceil(resources.vcpu())));
- }
-
- @Override
- public void getConfig(ThreadpoolConfig.Builder builder) {
- // Controls max number of concurrent requests per container
- int workerThreads = Math.max(2, (int)Math.ceil(resources.vcpu() * threadPoolSizeFactor));
- builder.maxthreads(workerThreads);
-
- // This controls your burst handling capability.
- // 0 => No extra burst handling beyond you max concurrent requests (maxthreads).
- // N => N times max concurrent requests as a buffer for handling bursts
- builder.queueSize((int)(workerThreads * queueSizeFactor));
- }
-}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java
index 97359b392a5..d493afd9c1f 100755
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java
@@ -10,11 +10,9 @@ import com.yahoo.config.model.deploy.TestProperties;
import com.yahoo.config.model.test.MockRoot;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Environment;
-import com.yahoo.config.provision.Flavor;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.Zone;
-import com.yahoo.config.provisioning.FlavorsConfig;
import com.yahoo.container.di.config.PlatformBundlesConfig;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
@@ -230,20 +228,6 @@ public class ContainerClusterTest {
}
@Test
- public void requireThatPoolAndQueueCanBeControlledByPropertiesAndFlavor() {
- FlavorsConfig.Flavor.Builder flavorBuilder = new FlavorsConfig.Flavor.Builder().name("my_flavor").minCpuCores(3);
- NodeResourcesTuning nodeResourcesTuning = new NodeResourcesTuning(new Flavor(new FlavorsConfig.Flavor(flavorBuilder)).resources())
- .setThreadPoolSizeFactor(13.3)
- .setQueueSizeFactor(17.5);
-
- ThreadpoolConfig.Builder tpBuilder = new ThreadpoolConfig.Builder();
- nodeResourcesTuning.getConfig(tpBuilder);
- ThreadpoolConfig threadpoolConfig = new ThreadpoolConfig(tpBuilder);
- assertEquals(40, threadpoolConfig.maxthreads());
- assertEquals(700, threadpoolConfig.queueSize());
- }
-
- @Test
public void requireThatDefaultThreadPoolConfigIsSane() {
MockRoot root = new MockRoot("foo");
ApplicationContainerCluster cluster = createContainerCluster(root, false);