aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java33
1 files changed, 25 insertions, 8 deletions
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 ac679cc406c..e04711a1c56 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
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container;
import ai.vespa.metricsproxy.http.application.ApplicationMetricsHandler;
@@ -17,6 +17,7 @@ import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.TreeConfigProducer;
import com.yahoo.config.provision.AllocatedHosts;
import com.yahoo.config.provision.HostSpec;
+import com.yahoo.config.provision.TenantName;
import com.yahoo.container.bundle.BundleInstantiationSpecification;
import com.yahoo.container.di.config.ApplicationBundlesConfig;
import com.yahoo.container.handler.metrics.MetricsProxyApiConfig;
@@ -48,10 +49,10 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.logging.Level;
import java.util.stream.Collectors;
import static com.yahoo.vespa.model.container.docproc.DocprocChains.DOCUMENT_TYPE_MANAGER_CLASS;
+import static java.util.logging.Level.FINE;
/**
* A container cluster that is typically set up from the user application.
@@ -78,6 +79,8 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
private static final BindingPattern PROMETHEUS_V1_HANDLER_BINDING_1 = SystemBindingPattern.fromHttpPath(PrometheusV1Handler.V1_PATH);
private static final BindingPattern PROMETHEUS_V1_HANDLER_BINDING_2 = SystemBindingPattern.fromHttpPath(PrometheusV1Handler.V1_PATH + "/*");
+ private static final TenantName HOSTED_VESPA = TenantName.from("hosted-vespa");
+
public static final int defaultHeapSizePercentageOfAvailableMemory = 85;
public static final int heapSizePercentageOfTotalAvailableMemoryWhenCombinedCluster = 24;
@@ -134,7 +137,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
? Math.min(99, deployState.featureFlags().heapSizePercentage())
: defaultHeapSizePercentageOfAvailableMemory;
onnxModelCost = deployState.onnxModelCost().newCalculator(
- deployState.getApplicationPackage(), deployState.getDeployLogger());
+ deployState.getApplicationPackage(), deployState.getProperties().applicationId());
logger = deployState.getDeployLogger();
}
@@ -163,7 +166,8 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
UserConfiguredFiles files = new UserConfiguredFiles(deployState.getFileRegistry(),
deployState.getDeployLogger(),
deployState.featureFlags(),
- userConfiguredUrls);
+ userConfiguredUrls,
+ deployState.getApplicationPackage());
for (Component<?, ?> component : getAllComponents()) {
files.register(component);
}
@@ -214,8 +218,8 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
double jvmHeapDeductionGb = dynamicHeapSize ? onnxModelCost.aggregatedModelCostInBytes() / (1024D * 1024 * 1024) : 0;
double availableMemory = Math.max(0, totalMemory - Host.memoryOverheadGb - jvmHeapDeductionGb);
int memoryPercentage = (int) (availableMemory / totalMemory * availableMemoryPercentage);
- logger.log(Level.FINE, () -> "memoryPercentage=%d, availableMemory=%f, totalMemory=%f, availableMemoryPercentage=%d, jvmHeapDeductionGb=%f"
- .formatted(memoryPercentage, availableMemory, totalMemory, availableMemoryPercentage, jvmHeapDeductionGb));
+ logger.log(FINE, () -> "cluster id '%s': memoryPercentage=%d, availableMemory=%f, totalMemory=%f, availableMemoryPercentage=%d, jvmHeapDeductionGb=%f"
+ .formatted(id(), memoryPercentage, availableMemory, totalMemory, availableMemoryPercentage, jvmHeapDeductionGb));
return Optional.of(JvmMemoryPercentage.of(memoryPercentage, availableMemory));
}
return Optional.empty();
@@ -223,8 +227,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
/** Create list of endpoints, these will be consumed later by LbServicesProducer */
private void createEndpoints(DeployState deployState) {
- if (!deployState.isHosted()) return;
- if (deployState.getProperties().applicationId().instance().isTester()) return;
+ if (!configureEndpoints(deployState)) return;
// Add endpoints provided by the controller
List<String> hosts = getContainers().stream().map(AbstractService::getHostName).sorted().toList();
List<ApplicationClusterEndpoint> endpoints = new ArrayList<>();
@@ -241,6 +244,12 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
.authMethod(ce.authMethod())
.build())
));
+ if (endpoints.stream().noneMatch(endpoint -> endpoint.scope() == ApplicationClusterEndpoint.Scope.zone)) {
+ throw new IllegalArgumentException("Expected at least one " + ApplicationClusterEndpoint.Scope.zone +
+ " endpoint for cluster '" + name() + "' in application '" +
+ deployState.getProperties().applicationId() +
+ "', got " + deployState.getEndpoints());
+ }
this.endpoints = Collections.unmodifiableList(endpoints);
}
@@ -374,6 +383,14 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
public OnnxModelCost.Calculator onnxModelCost() { return onnxModelCost; }
+ /** Returns whether the deployment in given deploy state should have endpoints */
+ private static boolean configureEndpoints(DeployState deployState) {
+ if (!deployState.isHosted()) return false;
+ if (deployState.getProperties().applicationId().instance().isTester()) return false;
+ if (deployState.getProperties().applicationId().tenant().equals(HOSTED_VESPA)) return false;
+ return true;
+ }
+
public static class MbusParams {
// the amount of the maxpendingbytes to process concurrently, typically 0.2 (20%)
final Double maxConcurrentFactor;