summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java9
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java12
-rw-r--r--container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java5
3 files changed, 8 insertions, 18 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java b/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java
index d13709114bf..a2181f317a6 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/http/JettyHttpServer.java
@@ -70,18 +70,11 @@ public class JettyHttpServer extends SimpleComponent implements ServerConfig.Pro
private void configureJettyThreadpool(ServerConfig.Builder builder) {
if (cluster == null) return;
if (cluster instanceof ApplicationContainerCluster) {
- configureApplicationClusterJettyThreadPool(builder);
+ if (isHostedVespa) builder.minWorkerThreads(-1).maxWorkerThreads(-1);
} else {
builder.minWorkerThreads(4).maxWorkerThreads(4);
}
}
- private void configureApplicationClusterJettyThreadPool(ServerConfig.Builder builder) {
- double vcpu = cluster.vcpu().orElse(0);
- if (vcpu > 0) {
- int threads = 16 + (int) Math.ceil(vcpu);
- builder.minWorkerThreads(threads).maxWorkerThreads(threads);
- }
- }
static ComponentModel providerComponentModel(String parentId, String className) {
final ComponentSpecification classNameSpec = new ComponentSpecification(
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 a66ea736a5b..60dac5926f4 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
@@ -299,23 +299,19 @@ public class ContainerClusterTest {
@Test
public void jetty_threadpool_scales_with_node_resources() {
- HostProvisionerWithCustomRealResource hostProvisioner = new HostProvisionerWithCustomRealResource(12);
MockRoot root = new MockRoot(
"foo",
new DeployState.Builder()
+ .properties(new TestProperties().setHostedVespa(true))
.applicationPackage(new MockApplicationPackage.Builder().build())
- .modelHostProvisioner(hostProvisioner)
.build());
ApplicationContainerCluster cluster = createContainerCluster(root, false);
- HostResource hostResource = new HostResource(
- new Host(null, "host-c1"),
- hostProvisioner.allocateHost("host-c1"));
- addContainerWithHostResource(root, cluster, "c1", hostResource);
+ addContainer(root, cluster, "c1", "host-c1");
root.freezeModelTopology();
ServerConfig cfg = root.getConfig(ServerConfig.class, "container0/c1/DefaultHttpServer");
- assertEquals(28, cfg.maxWorkerThreads());
- assertEquals(28, cfg.minWorkerThreads());
+ assertEquals(-1, cfg.maxWorkerThreads()); // Scale with cpu count observed by JVM
+ assertEquals(-1, cfg.minWorkerThreads()); // Scale with cpu count observed by JVM
}
@Test
diff --git a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java
index 70f173b74e5..e13d76b5720 100644
--- a/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java
+++ b/container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/JettyHttpServer.java
@@ -132,9 +132,10 @@ public class JettyHttpServer extends AbstractServerProvider {
}
private static void configureJettyThreadpool(Server server, ServerConfig config) {
+ int cpus = Runtime.getRuntime().availableProcessors();
QueuedThreadPool pool = (QueuedThreadPool) server.getThreadPool();
- pool.setMaxThreads(config.maxWorkerThreads());
- pool.setMinThreads(config.minWorkerThreads());
+ pool.setMaxThreads(config.maxWorkerThreads() > 0 ? config.maxWorkerThreads() : 16 + cpus);
+ pool.setMinThreads(config.minWorkerThreads() >= 0 ? config.minWorkerThreads() : 16 + cpus);
}
private static JMXServiceURL createJmxLoopbackOnlyServiceUrl(int port) {