summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-10-08 16:15:36 +0200
committerGitHub <noreply@github.com>2020-10-08 16:15:36 +0200
commitf6e624397e546eb6e4ef2d0345267c88b0b6f3e7 (patch)
tree0c81b8730c68ec654144d906199484bf6aa76e26
parent07aec913686ddb759996f11e2d234656f9a7ba4e (diff)
parentbe03cedb06d196714fd3c86de9cb4e00a5a0dfbb (diff)
Merge pull request #14781 from vespa-engine/bjorncs/adaptable-default-threadpool
Bjorncs/adaptable default threadpool
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/LogserverContainerCluster.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainerCluster.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerCluster.java6
-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/ApplicationContainerCluster.java5
-rwxr-xr-xconfig-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java7
-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.java52
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/xml/SearchHandler.java4
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/vespa/model/container/ContainerClusterTest.java65
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/HostProvisionerWithCustomRealResource.java40
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java34
12 files changed, 158 insertions, 86 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/LogserverContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/LogserverContainerCluster.java
index 9ae9a158631..0a61b5c91c6 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/LogserverContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/LogserverContainerCluster.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.model.admin;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
-import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
import com.yahoo.vespa.model.container.component.Handler;
@@ -25,11 +24,6 @@ public class LogserverContainerCluster extends ContainerCluster<LogserverContain
protected void doPrepare(DeployState deployState) { }
@Override
- public void getConfig(ThreadpoolConfig.Builder builder) {
- builder.maxthreads(10);
- }
-
- @Override
public void getConfig(QrStartConfig.Builder builder) {
super.getConfig(builder);
builder.jvm.heapsize(384)
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainerCluster.java
index 41d9df414ea..5cee73dff1b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainerCluster.java
@@ -3,7 +3,6 @@ package com.yahoo.vespa.model.admin.clustercontroller;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
-import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.vespa.model.container.ContainerCluster;
/**
@@ -19,11 +18,6 @@ public class ClusterControllerContainerCluster extends ContainerCluster<ClusterC
}
@Override
- public void getConfig(ThreadpoolConfig.Builder builder) {
- builder.maxthreads(10);
- }
-
- @Override
protected void doPrepare(DeployState deployState) { }
protected boolean messageBusEnabled() { return false; }
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerCluster.java
index fbf6dcfd5eb..4b9e1c302b7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/metricsproxy/MetricsProxyContainerCluster.java
@@ -28,7 +28,6 @@ import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.config.model.producer.AbstractConfigProducerRoot;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Zone;
-import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.container.jdisc.ThreadedHttpRequestHandler;
import com.yahoo.osgi.provider.model.ComponentModel;
import com.yahoo.vespa.model.VespaModel;
@@ -198,11 +197,6 @@ public class MetricsProxyContainerCluster extends ContainerCluster<MetricsProxyC
}
}
- @Override
- public void getConfig(ThreadpoolConfig.Builder builder) {
- builder.maxthreads(10);
- }
-
protected boolean messageBusEnabled() { return false; }
private MetricSet getAdditionalDefaultMetrics() {
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/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
index 7822b03db08..11e74fa6136 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
@@ -10,7 +10,6 @@ import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
import com.yahoo.container.di.config.ApplicationBundlesConfig;
-import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.container.handler.metrics.MetricsProxyApiConfig;
import com.yahoo.container.handler.metrics.MetricsV2Handler;
import com.yahoo.container.handler.metrics.PrometheusV1Handler;
@@ -274,10 +273,6 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
null))));
}
- @Override
- public void getConfig(ThreadpoolConfig.Builder builder) {
- }
-
public static class MbusParams {
// the amount of the maxpendingbytes to process concurrently, typically 0.2 (20%)
final Double maxConcurrentFactor;
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 87e8f16f88c..6b47584908f 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
@@ -17,9 +17,7 @@ import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
import com.yahoo.container.core.ApplicationMetadataConfig;
import com.yahoo.container.core.document.ContainerDocumentConfig;
-import com.yahoo.container.handler.ThreadPoolProvider;
import com.yahoo.container.di.config.PlatformBundlesConfig;
-import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.container.jdisc.JdiscBindingsConfig;
import com.yahoo.container.jdisc.config.HealthMonitorConfig;
import com.yahoo.container.jdisc.state.StateHandler;
@@ -100,8 +98,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
DocprocConfig.Producer,
ClusterInfoConfig.Producer,
RoutingProviderConfig.Producer,
- ConfigserverConfig.Producer,
- ThreadpoolConfig.Producer
+ ConfigserverConfig.Producer
{
/**
@@ -170,7 +167,7 @@ public abstract class ContainerCluster<CONTAINER extends Container>
addComponent(new StatisticsComponent());
addSimpleComponent(AccessLog.class);
- addSimpleComponent(ThreadPoolProvider.class);
+ addComponent(new DefaultThreadpoolProvider(this, deployState));
addSimpleComponent(com.yahoo.concurrent.classlock.ClassLocking.class);
addSimpleComponent(SecurityFilterInvoker.class);
addSimpleComponent("com.yahoo.container.jdisc.metric.MetricConsumerProviderProvider");
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
new file mode 100644
index 00000000000..17040caf5c2
--- /dev/null
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/DefaultThreadpoolProvider.java
@@ -0,0 +1,52 @@
+// Copyright Verizon Media. 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.model.deploy.DeployState;
+import com.yahoo.container.bundle.BundleInstantiationSpecification;
+import com.yahoo.container.handler.ThreadPoolProvider;
+import com.yahoo.container.handler.ThreadpoolConfig;
+import com.yahoo.osgi.provider.model.ComponentModel;
+import com.yahoo.vespa.model.container.component.SimpleComponent;
+
+/**
+ * Component definition for the jdisc default threadpool provider ({@link ThreadPoolProvider}).
+ *
+ * @author bjorncs
+ */
+class DefaultThreadpoolProvider extends SimpleComponent implements ThreadpoolConfig.Producer {
+
+ private final ContainerCluster<?> cluster;
+ private final DeployState deployState;
+
+ DefaultThreadpoolProvider(ContainerCluster<?> cluster, DeployState deployState) {
+ super(new ComponentModel(
+ BundleInstantiationSpecification.getFromStrings(
+ "default-threadpool",
+ ThreadPoolProvider.class.getName(),
+ null)));
+ this.cluster = cluster;
+ this.deployState = deployState;
+ }
+
+ @Override
+ public void getConfig(ThreadpoolConfig.Builder builder) {
+ if (!(cluster instanceof ApplicationContainerCluster)) {
+ // Container clusters such as logserver, metricsproxy and clustercontroller
+ int defaultWorkerThreads = 10;
+ builder.maxthreads(defaultWorkerThreads);
+ builder.corePoolSize(defaultWorkerThreads);
+ builder.queueSize(50);
+ return;
+ }
+
+ double threadPoolSizeFactor = deployState.getProperties().threadPoolSizeFactor();
+ double vcpu = ContainerThreadpool.vcpu(cluster).orElse(0);
+ if (threadPoolSizeFactor <= 0 || vcpu == 0) return;
+
+ // Configuration is currently identical to the search handler's threadpool
+ int workerThreads = Math.max(16, (int)Math.ceil(vcpu * threadPoolSizeFactor)); // TODO(bjorncs): reduce minimum size
+ builder.maxthreads(workerThreads);
+ builder.corePoolSize(workerThreads);
+ builder.queueSize((int)(workerThreads * deployState.getProperties().queueSizeFactor()));
+ }
+}
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 81ab2cc1503..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,14 +57,14 @@ 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);
builder.queueSize(0);
} else {
// Controls max number of concurrent requests per container
- int workerThreads = Math.max(2, (int)Math.ceil(vcpu * threadPoolSizeFactor));
+ int workerThreads = Math.max(16, (int)Math.ceil(vcpu * threadPoolSizeFactor)); // TODO(bjorncs): reduce minimum size
builder.maxThreads(workerThreads);
builder.minThreads(workerThreads);
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 d493afd9c1f..3515efb7bc1 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
@@ -4,9 +4,11 @@ package com.yahoo.vespa.model.container;
import com.yahoo.cloud.config.ClusterInfoConfig;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.cloud.config.RoutingProviderConfig;
+import com.yahoo.component.ComponentId;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.deploy.TestProperties;
+import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.model.test.MockRoot;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Environment;
@@ -14,6 +16,7 @@ import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.SystemName;
import com.yahoo.config.provision.Zone;
import com.yahoo.container.di.config.PlatformBundlesConfig;
+import com.yahoo.container.handler.ThreadPoolProvider;
import com.yahoo.container.handler.ThreadpoolConfig;
import com.yahoo.search.config.QrStartConfig;
import com.yahoo.vespa.model.Host;
@@ -33,6 +36,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
+import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -167,12 +171,11 @@ public class ContainerClusterTest {
assertEquals(512, qrStartConfig.jvm().heapsize());
assertEquals(32, qrStartConfig.jvm().compressedClassSpaceSize());
assertEquals(0, qrStartConfig.jvm().heapSizeAsPercentageOfPhysicalMemory());
+ root.freezeModelTopology();
- ThreadpoolConfig.Builder tpBuilder = new ThreadpoolConfig.Builder();
- cluster.getConfig(tpBuilder);
- ThreadpoolConfig threadpoolConfig = new ThreadpoolConfig(tpBuilder);
+ ThreadpoolConfig threadpoolConfig = root.getConfig(ThreadpoolConfig.class, "container0/component/default-threadpool");
assertEquals(10, threadpoolConfig.maxthreads());
- assertEquals(0, threadpoolConfig.queueSize());
+ assertEquals(50, threadpoolConfig.queueSize());
}
@Test
@@ -219,10 +222,9 @@ public class ContainerClusterTest {
MockRoot root = new MockRoot("foo", state);
ApplicationContainerCluster cluster = createContainerCluster(root, false);
addContainer(root.deployLogger(), cluster, "c1", "host-c1");
+ root.freezeModelTopology();
- ThreadpoolConfig.Builder tpBuilder = new ThreadpoolConfig.Builder();
- cluster.getConfig(tpBuilder);
- ThreadpoolConfig threadpoolConfig = new ThreadpoolConfig(tpBuilder);
+ ThreadpoolConfig threadpoolConfig = root.getConfig(ThreadpoolConfig.class, "container0/component/default-threadpool");
assertEquals(500, threadpoolConfig.maxthreads());
assertEquals(0, threadpoolConfig.queueSize());
}
@@ -232,15 +234,52 @@ public class ContainerClusterTest {
MockRoot root = new MockRoot("foo");
ApplicationContainerCluster cluster = createContainerCluster(root, false);
addContainer(root.deployLogger(), cluster, "c1", "host-c1");
+ root.freezeModelTopology();
- ThreadpoolConfig.Builder tpBuilder = new ThreadpoolConfig.Builder();
- cluster.getConfig(tpBuilder);
- ThreadpoolConfig threadpoolConfig = new ThreadpoolConfig(tpBuilder);
+ ThreadpoolConfig threadpoolConfig = root.getConfig(ThreadpoolConfig.class, "container0/component/default-threadpool");
assertEquals(500, threadpoolConfig.maxthreads());
assertEquals(0, threadpoolConfig.queueSize());
}
@Test
+ public void container_cluster_has_default_threadpool_provider() {
+ MockRoot root = new MockRoot("foo");
+ ApplicationContainerCluster cluster = createContainerCluster(root, false);
+ addContainer(root.deployLogger(), cluster, "c1", "host-c1");
+ root.freezeModelTopology();
+
+ ComponentId expectedComponentId = new ComponentId("default-threadpool");
+ var components = cluster.getComponentsMap();
+ assertThat(components, hasKey(expectedComponentId));
+ Component<?, ?> component = components.get(expectedComponentId);
+ assertEquals(ThreadPoolProvider.class.getName(), component.getClassId().getName());
+ }
+
+ @Test
+ public void config_for_default_threadpool_provider_scales_with_node_resources() {
+ HostProvisionerWithCustomRealResource hostProvisioner = new HostProvisionerWithCustomRealResource();
+ MockRoot root = new MockRoot(
+ "foo",
+ new DeployState.Builder()
+ .properties(new TestProperties()
+ .setThreadPoolSizeFactor(4)
+ .setQueueSizeFactor(20))
+ .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.deployLogger(), cluster, "c1", hostResource);
+ root.freezeModelTopology();
+
+ ThreadpoolConfig threadpoolConfig = root.getConfig(ThreadpoolConfig.class, "container0/component/default-threadpool");
+ assertEquals(16, threadpoolConfig.maxthreads());
+ assertEquals(320, threadpoolConfig.queueSize());
+ }
+
+ @Test
public void requireThatRoutingProviderIsDisabledForNonHosted() {
DeployState state = new DeployState.Builder().properties(new TestProperties().setHostedVespa(false)).build();
MockRoot root = new MockRoot("foo", state);
@@ -287,8 +326,12 @@ public class ContainerClusterTest {
private static void addContainer(DeployLogger deployLogger, ApplicationContainerCluster cluster, String name, String hostName) {
+ addContainerWithHostResource(deployLogger, cluster, name, new HostResource(new Host(null, hostName)));
+ }
+
+ private static void addContainerWithHostResource(DeployLogger deployLogger, ApplicationContainerCluster cluster, String name, HostResource hostResource) {
ApplicationContainer container = new ApplicationContainer(cluster, name, 0, cluster.isHostedVespa());
- container.setHostResource(new HostResource(new Host(null, hostName)));
+ container.setHostResource(hostResource);
container.initService(deployLogger);
cluster.addContainer(container);
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/HostProvisionerWithCustomRealResource.java b/config-model/src/test/java/com/yahoo/vespa/model/container/HostProvisionerWithCustomRealResource.java
new file mode 100644
index 00000000000..450049ffe99
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/HostProvisionerWithCustomRealResource.java
@@ -0,0 +1,40 @@
+// Copyright Verizon Media. 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.model.api.HostProvisioner;
+import com.yahoo.config.model.provision.Host;
+import com.yahoo.config.provision.Capacity;
+import com.yahoo.config.provision.ClusterMembership;
+import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.HostSpec;
+import com.yahoo.config.provision.NodeResources;
+import com.yahoo.config.provision.ProvisionLogger;
+import com.yahoo.net.HostName;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @author bjorncs
+ */
+public class HostProvisionerWithCustomRealResource implements HostProvisioner {
+
+ @Override
+ public HostSpec allocateHost(String alias) {
+ Host host = new Host(HostName.getLocalhost());
+ ClusterMembership membership = ClusterMembership.from(
+ ClusterSpec
+ .specification(
+ ClusterSpec.Type.container,
+ ClusterSpec.Id.from("id"))
+ .vespaVersion("")
+ .group(ClusterSpec.Group.from(0))
+ .build(),
+ 0);
+ return new HostSpec(
+ host.hostname(), new NodeResources(4, 0, 0, 0), NodeResources.unspecified(), NodeResources.unspecified(),
+ membership, Optional.empty(), Optional.empty(), Optional.empty());
+ }
+
+ @Override public List<HostSpec> prepare(ClusterSpec cluster, Capacity capacity, ProvisionLogger logger) { return List.of(); }
+}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java
index def5da3a9c2..9f061dcbd0a 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/ContainerDocumentApiBuilderTest.java
@@ -1,20 +1,12 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.xml;
-import com.yahoo.config.model.api.HostProvisioner;
import com.yahoo.config.model.builder.xml.test.DomBuilderTest;
-import com.yahoo.config.model.provision.Host;
import com.yahoo.config.model.test.MockApplicationPackage;
import com.yahoo.config.model.test.MockRoot;
-import com.yahoo.config.provision.Capacity;
-import com.yahoo.config.provision.ClusterMembership;
-import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.config.provision.HostSpec;
-import com.yahoo.config.provision.NodeResources;
-import com.yahoo.config.provision.ProvisionLogger;
import com.yahoo.container.handler.threadpool.ContainerThreadpoolConfig;
-import com.yahoo.net.HostName;
import com.yahoo.vespa.model.container.ContainerCluster;
+import com.yahoo.vespa.model.container.HostProvisionerWithCustomRealResource;
import com.yahoo.vespa.model.container.component.Handler;
import com.yahoo.vespa.model.container.component.SystemBindingPattern;
import com.yahoo.vespa.model.container.component.UserBindingPattern;
@@ -23,9 +15,7 @@ import org.w3c.dom.Element;
import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -158,26 +148,4 @@ public class ContainerDocumentApiBuilderTest extends ContainerModelBuilderTestBa
assertEquals(1000, feedThreadpoolConfig.queueSize());
}
- private static class HostProvisionerWithCustomRealResource implements HostProvisioner {
-
- @Override
- public HostSpec allocateHost(String alias) {
- Host host = new Host(HostName.getLocalhost());
- ClusterMembership membership = ClusterMembership.from(
- ClusterSpec
- .specification(
- ClusterSpec.Type.container,
- ClusterSpec.Id.from("id"))
- .vespaVersion("")
- .group(ClusterSpec.Group.from(0))
- .build(),
- 0);
- return new HostSpec(
- host.hostname(), new NodeResources(4, 0, 0, 0), NodeResources.unspecified(), NodeResources.unspecified(),
- membership, Optional.empty(), Optional.empty(), Optional.empty());
- }
-
- @Override public List<HostSpec> prepare(ClusterSpec cluster, Capacity capacity, ProvisionLogger logger) { return List.of(); }
- }
-
}