diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-07-07 18:08:51 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-07-07 18:08:51 +0200 |
commit | c7d757af332c8427d178473c7a8399c3aeb88b35 (patch) | |
tree | dfdad82f9390e930bc2ca4185e8bfa19bf025bcc /config-model | |
parent | 17f497e0b727415ff92d309073c784bceb7597d7 (diff) |
Reduce threads in clustercontroller threadpool from 500 to 10.
Reduce heap size to from 1536M to 512M.
Diffstat (limited to 'config-model')
2 files changed, 45 insertions, 4 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java index e39bddd5594..9a573172ec9 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/clustercontroller/ClusterControllerContainer.java @@ -6,8 +6,10 @@ import com.yahoo.component.ComponentSpecification; import com.yahoo.config.model.producer.AbstractConfigProducer; import com.yahoo.container.BundlesConfig; import com.yahoo.container.bundle.BundleInstantiationSpecification; +import com.yahoo.container.handler.ThreadpoolConfig; import com.yahoo.log.LogLevel; import com.yahoo.osgi.provider.model.ComponentModel; +import com.yahoo.search.config.QrStartConfig; import com.yahoo.vespa.config.content.FleetcontrollerConfig; import static com.yahoo.vespa.defaults.Defaults.getDefaults; import com.yahoo.vespa.model.application.validation.RestartConfigs; @@ -23,7 +25,12 @@ import java.util.TreeSet; * Extends the container producer to allow us to override ports. */ @RestartConfigs({FleetcontrollerConfig.class, ZookeeperServerConfig.class}) -public class ClusterControllerContainer extends Container implements BundlesConfig.Producer, ZookeeperServerConfig.Producer { +public class ClusterControllerContainer extends Container implements + BundlesConfig.Producer, + ZookeeperServerConfig.Producer, + QrStartConfig.Producer, + ThreadpoolConfig.Producer +{ private static final ComponentSpecification CLUSTERCONTROLLER_BUNDLE = new ComponentSpecification("clustercontroller-apps"); private static final ComponentSpecification ZKFACADE_BUNDLE = new ComponentSpecification("zkfacade"); private final int index; @@ -104,6 +111,15 @@ public class ClusterControllerContainer extends Container implements BundlesConf builder.myid(index); } + @Override + public void getConfig(QrStartConfig.Builder builder) { + builder.jvm(new QrStartConfig.Jvm.Builder().heapsize(512)); + } + @Override + public void getConfig(ThreadpoolConfig.Builder builder) { + builder.maxthreads(10); + } + int getIndex() { return index; } 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 c6de6835d49..8ae3c982d81 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 @@ -10,10 +10,12 @@ import com.yahoo.config.model.test.MockRoot; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.Zone; +import com.yahoo.container.handler.ThreadpoolConfig; import com.yahoo.container.jdisc.config.MetricDefaultsConfig; import com.yahoo.search.config.QrStartConfig; import com.yahoo.vespa.model.Host; import com.yahoo.vespa.model.HostResource; +import com.yahoo.vespa.model.admin.clustercontroller.ClusterControllerContainer; import com.yahoo.vespa.model.container.docproc.ContainerDocproc; import com.yahoo.vespa.model.container.search.ContainerSearch; import com.yahoo.vespa.model.container.search.searchchain.SearchChains; @@ -130,6 +132,25 @@ public class ContainerClusterTest { container.setJvmArgs(null); verifyJvmArgs(isHosted, hasDocProc, "", container.getJvmArgs()); } + + @Test + public void testClusterControllerResourceUsage() { + boolean isHosted = false; + ContainerCluster cluster = createContainerCluster(isHosted); + addClusterController(cluster, "host-c1"); + assertEquals(1, cluster.getContainers().size()); + ClusterControllerContainer container = (ClusterControllerContainer) cluster.getContainers().get(0); + QrStartConfig.Builder qrBuilder = new QrStartConfig.Builder(); + container.getConfig(qrBuilder); + QrStartConfig qrStartConfig = new QrStartConfig(qrBuilder); + assertEquals(512, qrStartConfig.jvm().heapsize()); + + ThreadpoolConfig.Builder tpBuilder = new ThreadpoolConfig.Builder(); + container.getConfig(tpBuilder); + ThreadpoolConfig threadpoolConfig = new ThreadpoolConfig(tpBuilder); + assertEquals(10, threadpoolConfig.maxthreads()); + } + @Test public void requireThatJvmArgsControlWorksForHostedAndNot() { verifyJvmArgs(true, false); @@ -138,9 +159,6 @@ public class ContainerClusterTest { verifyJvmArgs(false, true); } - private void verifyThatWeCanHandleNull(boolean isHosted) { - - } @Test public void requireThatWeCanhandleNull() { ContainerCluster cluster = createContainerCluster(false); @@ -171,6 +189,13 @@ public class ContainerClusterTest { cluster.addContainer(container); } + private static void addClusterController(ContainerCluster cluster, String hostName) { + Container container = new ClusterControllerContainer(cluster, 1, false); + container.setHostResource(new HostResource(new Host(null, hostName))); + container.initService(); + cluster.addContainer(container); + } + private static ContainerCluster newContainerCluster() { ContainerCluster cluster = new ContainerCluster(null, "subId", "name"); addContainer(cluster, "c1", "host-c1"); |