diff options
author | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-09-21 15:18:21 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@yahooinc.com> | 2023-09-22 15:31:29 +0200 |
commit | d73ec0dbe017f8e02067aabefa0f421d63e332db (patch) | |
tree | 2880d03fdf8c95338ac88ea41d92c32a094204cb /config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java | |
parent | 492556f0ebd216b01fc4af7e0d32e51f6ade6927 (diff) |
Add feature flag to enable new JVM heap size calculation
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.java | 4 |
1 files changed, 3 insertions, 1 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 49ad67f633f..eb62cc1f2a4 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 @@ -97,6 +97,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat private int zookeeperSessionTimeoutSeconds = 30; private final int transport_events_before_wakeup; private final int transport_connections_per_target; + private final boolean dynamicHeapSize; /** The heap size % of total memory available to the JVM process. */ private final int heapSizePercentageOfAvailableMemory; @@ -108,6 +109,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat public ApplicationContainerCluster(TreeConfigProducer<?> parent, String configSubId, String clusterId, DeployState deployState) { super(parent, configSubId, clusterId, deployState, true, 10); this.tlsClientAuthority = deployState.tlsClientAuthority(); + dynamicHeapSize = deployState.featureFlags().dynamicHeapSize(); previousHosts = Collections.unmodifiableSet(deployState.getPreviousModel().stream() .map(Model::allocatedHosts) .map(AllocatedHosts::getHosts) @@ -200,7 +202,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat // Node memory is known so convert available memory percentage to node memory percentage double totalMemory = getContainers().get(0).getHostResource().realResources().memoryGb(); - double jvmHeapDeductionGb = onnxModelCost.aggregatedModelCostInBytes() / (1024D * 1024 * 1024); + 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" |