diff options
Diffstat (limited to 'config-model/src/main')
-rw-r--r-- | config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java | 9 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/HostResource.java | 9 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java | 4 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java | 9 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java (renamed from config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java) | 23 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java | 5 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java (renamed from config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java) | 43 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java | 12 |
8 files changed, 57 insertions, 57 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java b/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java index b38001d1267..009bc225037 100644 --- a/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java +++ b/config-model/src/main/java/com/yahoo/config/model/provision/InMemoryProvisioner.java @@ -9,7 +9,6 @@ import com.yahoo.config.provision.Capacity; import com.yahoo.config.provision.ClusterMembership; import com.yahoo.config.provision.ClusterResources; import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.HostSpec; import com.yahoo.config.provision.NodeResources; import com.yahoo.config.provision.ProvisionLogger; @@ -188,11 +187,11 @@ public class InMemoryProvisioner implements HostProvisioner { // Check if the current allocations are compatible with the new request for (int i = allocation.size() - 1; i >= 0; i--) { - Optional<NodeResources> currentResources = allocation.get(0).flavor().map(Flavor::resources); - if (currentResources.isEmpty() || requestedResources.isUnspecified()) continue; - if (!currentResources.get().compatibleWith(requestedResources)) { + NodeResources currentResources = allocation.get(0).advertisedResources(); + if (currentResources.isUnspecified() || requestedResources.isUnspecified()) continue; + if ( ! currentResources.compatibleWith(requestedResources)) { HostSpec removed = allocation.remove(i); - freeNodes.put(currentResources.get(), new Host(removed.hostname())); // Return the node back to free pool + freeNodes.put(currentResources, new Host(removed.hostname())); // Return the node back to free pool } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java b/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java index 0cc3f390db4..81931995485 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/HostResource.java @@ -5,6 +5,7 @@ import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.api.HostInfo; import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.HostSpec; +import com.yahoo.config.provision.NodeResources; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -98,8 +99,16 @@ public class HostResource implements Comparable<HostResource> { } /** Returns the flavor of this resource. Empty for self-hosted Vespa. */ + // TODO: Remove after June 2020 + @Deprecated public Optional<Flavor> getFlavor() { return spec.flavor(); } + /** The real resources available for Vespa processes on this node, after subtracting infrastructure overhead. */ + public NodeResources realResources() { return spec.realResources(); } + + /** The total advertised resources of this node, typically matching what's requested. */ + public NodeResources advertisedResources() { return spec.advertisedResources(); } + @Override public String toString() { return "host '" + host.getHostname() + "'"; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java index 292d4761d8a..3d2918e0ee1 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java @@ -120,7 +120,7 @@ public class HostSystem extends AbstractConfigProducer<Host> { HostResource host = getExistingHost(spec).orElseGet(() -> addNewHost(spec)); retAllocatedHosts.put(host, spec.membership().orElse(null)); } - retAllocatedHosts.keySet().forEach(host -> log.log(FINE, () -> "Allocated host " + host.getHostname() + " with flavor " + host.getFlavor())); + retAllocatedHosts.keySet().forEach(host -> log.log(FINE, () -> "Allocated host " + host.getHostname() + " with resources " + host.advertisedResources())); return retAllocatedHosts; } @@ -131,7 +131,7 @@ public class HostSystem extends AbstractConfigProducer<Host> { if (hosts.isEmpty()) { return Optional.empty(); } else { - log.log(FINE, () -> "Found existing host resource for " + key.hostname() + " with flavor " + hosts.get(0).getFlavor()); + log.log(FINE, () -> "Found existing host resource for " + key.hostname() + " with resources" + hosts.get(0).advertisedResources()); return Optional.of(hosts.get(0)); } } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java index 29bb578a67b..207e130eaaa 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainer.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.model.container; import com.yahoo.config.model.api.container.ContainerServiceType; import com.yahoo.config.model.producer.AbstractConfigProducer; -import com.yahoo.config.provision.Flavor; import com.yahoo.container.bundle.BundleInstantiationSpecification; import com.yahoo.container.handler.ThreadpoolConfig; import com.yahoo.osgi.provider.model.ComponentModel; @@ -45,8 +44,8 @@ public final class ApplicationContainer extends Container implements @Override public void getConfig(QrStartConfig.Builder builder) { if (getHostResource() != null) { - if (getHostResource().getFlavor().isPresent()) { - NodeFlavorTuning flavorTuning = new NodeFlavorTuning(getHostResource().getFlavor().get()); + if ( ! getHostResource().advertisedResources().isUnspecified()) { + NodeResourcesTuning flavorTuning = new NodeResourcesTuning(getHostResource().advertisedResources()); flavorTuning.getConfig(builder); } } @@ -80,11 +79,11 @@ public final class ApplicationContainer extends Container implements @Override public void getConfig(ThreadpoolConfig.Builder builder) { if (! (parent instanceof ContainerCluster)) return; - if ((getHostResource() == null) || getHostResource().getFlavor().isEmpty()) return; + if ((getHostResource() == null) || getHostResource().advertisedResources().isUnspecified()) return; ContainerCluster containerCluster = (ContainerCluster) parent; if (containerCluster.getThreadPoolSizeFactor() <= 0.0) return; - NodeFlavorTuning flavorTuning = new NodeFlavorTuning(getHostResource().getFlavor().get()) + NodeResourcesTuning flavorTuning = new NodeResourcesTuning(getHostResource().advertisedResources()) .setThreadPoolSizeFactor(containerCluster.getThreadPoolSizeFactor()) .setQueueSizeFactor(containerCluster.getQueueSizeFactor()); flavorTuning.getConfig(builder); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java index 247c675680b..7eb7a1fb518 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/NodeFlavorTuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/NodeResourcesTuning.java @@ -1,28 +1,25 @@ // Copyright 2019 Oath Inc. 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.provision.Flavor; +import com.yahoo.config.provision.NodeResources; import com.yahoo.container.handler.ThreadpoolConfig; import com.yahoo.search.config.QrStartConfig; /** - * Tuning of qr-start config for a container service based on the node flavor of that node. + * Tuning of qr-start config for a container service based on node resources. * * @author balder */ -public class NodeFlavorTuning implements - QrStartConfig.Producer, - ThreadpoolConfig.Producer -{ +public class NodeResourcesTuning implements QrStartConfig.Producer, ThreadpoolConfig.Producer { - private final Flavor flavor; + private final NodeResources resources; - public NodeFlavorTuning setThreadPoolSizeFactor(double threadPoolSizeFactor) { + public NodeResourcesTuning setThreadPoolSizeFactor(double threadPoolSizeFactor) { this.threadPoolSizeFactor = threadPoolSizeFactor; return this; } - public NodeFlavorTuning setQueueSizeFactor(double queueSizeFactor) { + public NodeResourcesTuning setQueueSizeFactor(double queueSizeFactor) { this.queueSizeFactor = queueSizeFactor; return this; } @@ -30,19 +27,19 @@ public class NodeFlavorTuning implements private double threadPoolSizeFactor = 8.0; private double queueSizeFactor = 8.0; - NodeFlavorTuning(Flavor flavor) { - this.flavor = flavor; + NodeResourcesTuning(NodeResources resources) { + this.resources = resources; } @Override public void getConfig(QrStartConfig.Builder builder) { - builder.jvm.availableProcessors(Math.max(2, (int)Math.ceil(flavor.resources().vcpu()))); + builder.jvm.availableProcessors(Math.max(2, (int)Math.ceil(resources.vcpu()))); } @Override public void getConfig(ThreadpoolConfig.Builder builder) { // Controls max number of concurrent requests per container - int workerThreads = Math.max(2, (int)Math.ceil(flavor.resources().vcpu() * threadPoolSizeFactor)); + int workerThreads = Math.max(2, (int)Math.ceil(resources.vcpu() * threadPoolSizeFactor)); builder.maxthreads(workerThreads); // This controls your burst handling capability. diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java index 8c3dce4d968..028aee369c3 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/StorageNode.java @@ -86,9 +86,8 @@ public class StorageNode extends ContentNode implements StorServerConfig.Produce @Override public void getConfig(StorFilestorConfig.Builder builder) { - if (getHostResource() != null && getHostResource().getFlavor().isPresent()) { - Flavor nodeFlavor = getHostResource().getFlavor().get(); - builder.num_threads(Math.max(4, (int)nodeFlavor.resources().vcpu())); + if (getHostResource() != null && ! getHostResource().advertisedResources().isUnspecified()) { + builder.num_threads(Math.max(4, (int)getHostResource().advertisedResources().vcpu())); } cluster.getConfig(builder); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java index 2f0d2bcf41e..ee854aaa9c3 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/NodeFlavorTuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/NodeResourcesTuning.java @@ -1,32 +1,31 @@ // 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.search; -import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.NodeResources; import com.yahoo.vespa.config.search.core.ProtonConfig; import static java.lang.Long.min; /** - * Tuning of proton config for a search node based on the node flavor of that node. + * Tuning of proton config for a search node based on the resources on the node. * * @author geirst */ -public class NodeFlavorTuning implements ProtonConfig.Producer { +public class NodeResourcesTuning implements ProtonConfig.Producer { final static long MB = 1024 * 1024; final static long GB = MB * 1024; - private final Flavor nodeFlavor; + private final NodeResources resources; private final int redundancy; private final int searchableCopies; private final int threadsPerSearch; - public NodeFlavorTuning(Flavor nodeFlavor, int redundancy, int searchableCopies) { - this(nodeFlavor, redundancy, searchableCopies, 1); + public NodeResourcesTuning(NodeResources resources, int redundancy, int searchableCopies) { + this(resources, redundancy, searchableCopies, 1); } - public NodeFlavorTuning(Flavor nodeFlavor, int redundancy, int searchableCopies, int threadsPerSearch) { - this.nodeFlavor = nodeFlavor; + public NodeResourcesTuning(NodeResources resources, int redundancy, int searchableCopies, int threadsPerSearch) { + this.resources = resources; this.redundancy = redundancy; this.searchableCopies = searchableCopies; this.threadsPerSearch = threadsPerSearch; @@ -52,31 +51,31 @@ public class NodeFlavorTuning implements ProtonConfig.Producer { private void getConfig(ProtonConfig.Documentdb.Builder builder) { ProtonConfig.Documentdb dbCfg = builder.build(); if (dbCfg.mode() != ProtonConfig.Documentdb.Mode.Enum.INDEX) { - long numDocs = (long)nodeFlavor.resources().memoryGb() * GB / 64L; + long numDocs = (long)resources.memoryGb() * GB / 64L; builder.allocation.initialnumdocs(numDocs/Math.max(searchableCopies, redundancy)); } } private void tuneSummaryCache(ProtonConfig.Summary.Cache.Builder builder) { - long memoryLimitBytes = (long) ((nodeFlavor.resources().memoryGb() * 0.05) * GB); + long memoryLimitBytes = (long) ((resources.memoryGb() * 0.05) * GB); builder.maxbytes(memoryLimitBytes); } private void setHwInfo(ProtonConfig.Builder builder) { - builder.hwinfo.disk.shared(nodeFlavor.getType().equals(Flavor.Type.DOCKER_CONTAINER)); - builder.hwinfo.cpu.cores((int)nodeFlavor.resources().vcpu()); - builder.hwinfo.memory.size((long)nodeFlavor.resources().memoryGb() * GB); - builder.hwinfo.disk.size((long)nodeFlavor.resources().diskGb() * GB); + builder.hwinfo.disk.shared(true); + builder.hwinfo.cpu.cores((int)resources.vcpu()); + builder.hwinfo.memory.size((long)resources.memoryGb() * GB); + builder.hwinfo.disk.size((long)resources.diskGb() * GB); } private void tuneDiskWriteSpeed(ProtonConfig.Builder builder) { - if (nodeFlavor.resources().diskSpeed() != NodeResources.DiskSpeed.fast) { + if (resources.diskSpeed() != NodeResources.DiskSpeed.fast) { builder.hwinfo.disk.writespeed(40); } } private void tuneDocumentStoreMaxFileSize(ProtonConfig.Summary.Log.Builder builder) { - double memoryGb = nodeFlavor.resources().memoryGb(); + double memoryGb = resources.memoryGb(); long fileSizeBytes = 4 * GB; if (memoryGb <= 12.0) { fileSizeBytes = 256 * MB; @@ -89,31 +88,31 @@ public class NodeFlavorTuning implements ProtonConfig.Producer { } private void tuneFlushStrategyMemoryLimits(ProtonConfig.Flush.Memory.Builder builder) { - long memoryLimitBytes = (long) ((nodeFlavor.resources().memoryGb() / 8) * GB); + long memoryLimitBytes = (long) ((resources.memoryGb() / 8) * GB); builder.maxmemory(memoryLimitBytes); builder.each.maxmemory(memoryLimitBytes); } private void tuneFlushStrategyTlsSize(ProtonConfig.Flush.Memory.Builder builder) { - long tlsSizeBytes = (long) ((nodeFlavor.resources().diskGb() * 0.07) * GB); + long tlsSizeBytes = (long) ((resources.diskGb() * 0.07) * GB); tlsSizeBytes = min(tlsSizeBytes, 100 * GB); builder.maxtlssize(tlsSizeBytes); } private void tuneSummaryReadIo(ProtonConfig.Summary.Read.Builder builder) { - if (nodeFlavor.resources().diskSpeed() == NodeResources.DiskSpeed.fast) { + if (resources.diskSpeed() == NodeResources.DiskSpeed.fast) { builder.io(ProtonConfig.Summary.Read.Io.DIRECTIO); } } private void tuneSearchReadIo(ProtonConfig.Search.Mmap.Builder builder) { - if (nodeFlavor.resources().diskSpeed() == NodeResources.DiskSpeed.fast) { + if (resources.diskSpeed() == NodeResources.DiskSpeed.fast) { builder.advise(ProtonConfig.Search.Mmap.Advise.RANDOM); } } private void tuneRequestThreads(ProtonConfig.Builder builder) { - int numCores = (int)Math.ceil(nodeFlavor.resources().vcpu()); + int numCores = (int)Math.ceil(resources.vcpu()); builder.numsearcherthreads(numCores*threadsPerSearch); builder.numsummarythreads(numCores); builder.numthreadspersearch(threadsPerSearch); @@ -123,7 +122,7 @@ public class NodeFlavorTuning implements ProtonConfig.Producer { // "Reserve" 1GB of memory for other processes running on the content node (config-proxy, cluster-controller, metrics-proxy) double reservedMemoryGb = 1; double defaultMemoryLimit = new ProtonConfig.Writefilter(new ProtonConfig.Writefilter.Builder()).memorylimit(); - double scaledMemoryLimit = ((nodeFlavor.resources().memoryGb() - reservedMemoryGb) * defaultMemoryLimit) / nodeFlavor.resources().memoryGb(); + double scaledMemoryLimit = ((resources.memoryGb() - reservedMemoryGb) * defaultMemoryLimit) / resources.memoryGb(); builder.memorylimit(scaledMemoryLimit); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java index 373c62c2eda..f908d091a72 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.model.search; import com.yahoo.cloud.config.filedistribution.FiledistributorrpcConfig; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.AbstractConfigProducer; -import com.yahoo.config.provision.Flavor; import com.yahoo.metrics.MetricsmanagerConfig; import com.yahoo.searchlib.TranslogserverConfig; import com.yahoo.vespa.config.content.LoadTypeConfig; @@ -270,12 +269,11 @@ public class SearchNode extends AbstractService implements // to make sure the node failer has done its work builder.pruneremoveddocumentsage(4 * 24 * 3600 + 3600 + 60); } - if (getHostResource() != null && getHostResource().getFlavor().isPresent()) { - Flavor nodeFlavor = getHostResource().getFlavor().get(); - NodeFlavorTuning nodeFlavorTuning = tuning.isPresent() - ? new NodeFlavorTuning(nodeFlavor, redundancy, searchableCopies, tuning.get().getNumThreadsPerSearch()) - : new NodeFlavorTuning(nodeFlavor, redundancy, searchableCopies); - nodeFlavorTuning.getConfig(builder); + if (getHostResource() != null && ! getHostResource().advertisedResources().isUnspecified()) { + NodeResourcesTuning nodeResourcesTuning = tuning.isPresent() + ? new NodeResourcesTuning(getHostResource().advertisedResources(), redundancy, searchableCopies, tuning.get().getNumThreadsPerSearch()) + : new NodeResourcesTuning(getHostResource().advertisedResources(), redundancy, searchableCopies); + nodeResourcesTuning.getConfig(builder); if (tuning.isPresent()) { tuning.get().getConfig(builder); |