diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-18 18:29:05 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-12-18 18:29:05 +0100 |
commit | 9b12362985923c15687d3128d63d3912ded6a0da (patch) | |
tree | a2edb39ef6612ba09416532aa724dc67216e1f4d | |
parent | 295762905a82caf53a375235617a0d612f2d6601 (diff) |
Expose memorypercentage on the ContainerCluster
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java | 20 | ||||
-rwxr-xr-x | config-model/src/main/java/com/yahoo/vespa/model/container/ContainerCluster.java | 5 |
2 files changed, 16 insertions, 9 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 e8be43fdc96..c4d420f2d44 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 @@ -167,11 +167,17 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat public void setMemoryPercentage(Integer memoryPercentage) { this.memoryPercentage = memoryPercentage; } - /** - * Returns the percentage of host physical memory this application has specified for nodes in this cluster, - * or empty if this is not specified by the application. - */ - public Optional<Integer> getMemoryPercentage() { return Optional.ofNullable(memoryPercentage); } + @Override + public Optional<Integer> getMemoryPercentage() { + if (memoryPercentage != null) { + return Optional.of(memoryPercentage); + } else if (isHostedVespa()) { + return getHostClusterId().isPresent() ? + Optional.of(heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster) : + Optional.of(heapSizePercentageOfTotalNodeMemory); + } + return Optional.empty(); + } /* Create list of endpoints, these will be consumed later by the LBservicesProducer @@ -291,10 +297,6 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat .heapsize(1536); if (getMemoryPercentage().isPresent()) { builder.jvm.heapSizeAsPercentageOfPhysicalMemory(getMemoryPercentage().get()); - } else if (isHostedVespa()) { - builder.jvm.heapSizeAsPercentageOfPhysicalMemory(getHostClusterId().isPresent() ? - heapSizePercentageOfTotalNodeMemoryWhenCombinedCluster : - heapSizePercentageOfTotalNodeMemory); } } 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 a9ce03d1d55..c73a3b2a676 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 @@ -653,4 +653,9 @@ public abstract class ContainerCluster<CONTAINER extends Container> public boolean getDeferChangesUntilRestart() { return deferChangesUntilRestart; } + /** + * Returns the percentage of host physical memory this application has specified for nodes in this cluster, + * or empty if this is not specified by the application. + */ + public Optional<Integer> getMemoryPercentage() { return Optional.empty(); } } |