aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java
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/vespa/model/container/ContainerThreadpool.java
parent5e76f0e3763a65067958d6ea4b38c3538d7d8aa9 (diff)
Use highest vcpu in case cluster is heterogenous
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ContainerThreadpool.java15
1 files changed, 5 insertions, 10 deletions
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 {