summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-10-08 13:55:18 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-10-08 13:55:18 +0200
commitbe03cedb06d196714fd3c86de9cb4e00a5a0dfbb (patch)
treeb9a54d5f0c0652a68aba02fbaf842c8f8fcd83b4 /config-model/src/main/java/com/yahoo
parent5e76f0e3763a65067958d6ea4b38c3538d7d8aa9 (diff)
Use highest vcpu in case cluster is heterogenous
Diffstat (limited to 'config-model/src/main/java/com/yahoo')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java15
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/DefaultThreadpoolProvider.java2
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/SearchHandler.java2
4 files changed, 9 insertions, 14 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java
index 9018a0231db..bc2e5cc2b8a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/clients/ContainerDocumentApi.java
@@ -122,13 +122,13 @@ public class ContainerDocumentApi {
}
private int maxPoolSize() {
- double vcpu = vcpu(cluster);
+ double vcpu = vcpu(cluster).orElse(0);
if (vcpu == 0) return FALLBACK_MAX_POOL_SIZE;
return Math.max(2, (int)Math.ceil(vcpu * feedThreadPoolSizeFactor));
}
private int minPoolSize() {
- double vcpu = vcpu(cluster);
+ double vcpu = vcpu(cluster).orElse(0);
if (vcpu == 0) return FALLBACK_CORE_POOL_SIZE;
return Math.max(1, (int)Math.ceil(vcpu * feedThreadPoolSizeFactor * 0.5));
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java
index 869248edfbf..93a02833d26 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java
@@ -10,9 +10,8 @@ import com.yahoo.text.XML;
import com.yahoo.vespa.model.container.component.SimpleComponent;
import org.w3c.dom.Element;
-import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
+import java.util.OptionalDouble;
/**
* Component definition for a {@link java.util.concurrent.Executor} using {@link ContainerThreadPool}.
@@ -49,15 +48,11 @@ public class ContainerThreadpool extends SimpleComponent implements ContainerThr
protected Optional<UserOptions> userOptions() { return Optional.ofNullable(userOptions); }
protected boolean hasUserOptions() { return userOptions().isPresent(); }
- protected static double vcpu(ContainerCluster<?> cluster) {
- List<Double> vcpus = cluster.getContainers().stream()
+ protected static OptionalDouble vcpu(ContainerCluster<?> cluster) {
+ return cluster.getContainers().stream()
.filter(c -> c.getHostResource() != null && c.getHostResource().realResources() != null)
- .map(c -> c.getHostResource().realResources().vcpu())
- .distinct()
- .collect(Collectors.toList());
- // We can only use host resource for calculation if all container nodes in the cluster are homogeneous (in terms of vcpu)
- if (vcpus.size() != 1 || vcpus.get(0) == 0) return 0;
- return vcpus.get(0);
+ .mapToDouble(c -> c.getHostResource().realResources().vcpu())
+ .max(); // Use highest vcpu as scale factor
}
public static class UserOptions {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/DefaultThreadpoolProvider.java b/config-model/src/main/java/com/yahoo/vespa/model/container/DefaultThreadpoolProvider.java
index 3ffb364eb12..17040caf5c2 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/DefaultThreadpoolProvider.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/DefaultThreadpoolProvider.java
@@ -40,7 +40,7 @@ class DefaultThreadpoolProvider extends SimpleComponent implements ThreadpoolCon
}
double threadPoolSizeFactor = deployState.getProperties().threadPoolSizeFactor();
- double vcpu = ContainerThreadpool.vcpu(cluster);
+ double vcpu = ContainerThreadpool.vcpu(cluster).orElse(0);
if (threadPoolSizeFactor <= 0 || vcpu == 0) return;
// Configuration is currently identical to the search handler's threadpool
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/SearchHandler.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/SearchHandler.java
index bbf2d7335af..8438214f1fd 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/SearchHandler.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/SearchHandler.java
@@ -57,7 +57,7 @@ class SearchHandler extends ProcessingHandler<SearchChains> {
if (hasUserOptions()) return;
double threadPoolSizeFactor = deployState.getProperties().threadPoolSizeFactor();
- double vcpu = vcpu(cluster);
+ double vcpu = vcpu(cluster).orElse(0);
if (threadPoolSizeFactor <= 0 || vcpu == 0) {
builder.maxThreads(500);
builder.minThreads(500);