aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java20
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java18
-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/NodeFlavorTuning.java30
4 files changed, 80 insertions, 2 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
index 99225beba4f..d799af36c3b 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
@@ -43,6 +43,8 @@ public class TestProperties implements ModelContext.Properties {
private double topKProbability = 1.0;
private double defaultTermwiseLimit = 1.0;
private double softStartSeconds = 0.0;
+ private double threadPoolSizeFactor = 0.0;
+ private double queueSizeFactor = 0.0;
private Optional<EndpointCertificateSecrets> endpointCertificateSecrets = Optional.empty();
private AthenzDomain athenzDomain;
@@ -65,6 +67,16 @@ public class TestProperties implements ModelContext.Properties {
@Override public double defaultTermwiseLimit() { return defaultTermwiseLimit; }
@Override
+ public double threadPoolSizeFactor() {
+ return threadPoolSizeFactor;
+ }
+
+ @Override
+ public double queueSizeFactor() {
+ return queueSizeFactor;
+ }
+
+ @Override
public double defaultSoftStartSeconds() {
return softStartSeconds;
}
@@ -86,7 +98,15 @@ public class TestProperties implements ModelContext.Properties {
this.softStartSeconds = softStartSeconds;
return this;
}
+ public TestProperties setThreadPoolSizeFactor(double threadPoolSizeFactor) {
+ this.threadPoolSizeFactor = threadPoolSizeFactor;
+ return this;
+ }
+ public TestProperties setQueueSizeFactor(double queueSizeFactor) {
+ this.queueSizeFactor = queueSizeFactor;
+ return this;
+ }
public TestProperties setApplicationId(ApplicationId applicationId) {
this.applicationId = applicationId;
return this;
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 e59baf88422..29bb578a67b 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
@@ -5,6 +5,7 @@ import com.yahoo.config.model.api.container.ContainerServiceType;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.config.provision.Flavor;
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,7 +16,10 @@ import com.yahoo.vespa.model.container.component.Component;
*
* @author gjoranv
*/
-public final class ApplicationContainer extends Container implements QrStartConfig.Producer {
+public final class ApplicationContainer extends Container implements
+ QrStartConfig.Producer,
+ ThreadpoolConfig.Producer
+{
private static final String defaultHostedJVMArgs = "-XX:+UseOSErrorReporting -XX:+SuppressFatalErrorMessage";
@@ -73,4 +77,16 @@ public final class ApplicationContainer extends Container implements QrStartConf
return (parent instanceof ContainerCluster) && (((ContainerCluster)parent).getDocproc() != null);
}
+ @Override
+ public void getConfig(ThreadpoolConfig.Builder builder) {
+ if (! (parent instanceof ContainerCluster)) return;
+ if ((getHostResource() == null) || getHostResource().getFlavor().isEmpty()) return;
+ ContainerCluster containerCluster = (ContainerCluster) parent;
+ if (containerCluster.getThreadPoolSizeFactor() <= 0.0) return;
+
+ NodeFlavorTuning flavorTuning = new NodeFlavorTuning(getHostResource().getFlavor().get())
+ .setThreadPoolSizeFactor(containerCluster.getThreadPoolSizeFactor())
+ .setQueueSizeFactor(containerCluster.getQueueSizeFactor());
+ flavorTuning.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 833f6688fbc..b35b7562704 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,12 +160,18 @@ 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");
addComponent(new StatisticsComponent());
@@ -186,6 +192,14 @@ 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/NodeFlavorTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java
index 67938b36fd9..f9b50d0e641 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java
@@ -2,6 +2,7 @@
package com.yahoo.vespa.model.container;
import com.yahoo.config.provision.Flavor;
+import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
/**
@@ -9,10 +10,26 @@ import com.yahoo.search.config.QrStartConfig;
*
* @author balder
*/
-public class NodeFlavorTuning implements QrStartConfig.Producer {
+public class NodeFlavorTuning implements
+ QrStartConfig.Producer,
+ ThreadpoolConfig.Producer
+{
private final Flavor flavor;
+ public NodeFlavorTuning setThreadPoolSizeFactor(double threadPoolSizeFactor) {
+ this.threadPoolSizeFactor = threadPoolSizeFactor;
+ return this;
+ }
+
+ public NodeFlavorTuning setQueueSizeFactor(double queueSizeFactor) {
+ this.queueSizeFactor = queueSizeFactor;
+ return this;
+ }
+
+ private double threadPoolSizeFactor = 8.0;
+ private double queueSizeFactor = 8.0;
+
NodeFlavorTuning(Flavor flavor) {
this.flavor = flavor;
}
@@ -22,4 +39,15 @@ public class NodeFlavorTuning implements QrStartConfig.Producer {
builder.jvm.availableProcessors(Math.max(2, (int)Math.ceil(flavor.getMinCpuCores())));
}
+ @Override
+ public void getConfig(ThreadpoolConfig.Builder builder) {
+ // Controls max number of concurrent requests per container
+ int workerThreads = Math.max(2, (int)Math.ceil(flavor.getMinCpuCores() * 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));
+ }
}