summaryrefslogtreecommitdiffstats
path: root/container-disc
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@yahoo-inc.com>2016-10-03 17:02:57 +0200
committerHåkon Hallingstad <hakon@yahoo-inc.com>2016-10-03 17:02:57 +0200
commit98ec1ff03137e089734ce0a90df38e234be9409d (patch)
treeea3fdad7646e333be733ba191bcf391851a3a30c /container-disc
parent281d4a8ca3029bb732ab14021bb5b03968354fe5 (diff)
Use jvm_heapsize for container's Java process if explicitly set
Also simplifies the logic a bit: - If jvm_heapsize has been set by model, use that - Otherwise, if jvm_heapSizeAsPercentageOfPhysicalMemory has been set, use that to calculate the heapsize. Takes into account that TOTAL_MEMORY_MB may have been set to override the size of the physical memory. - Otherwise, use 1536MB.
Diffstat (limited to 'container-disc')
-rwxr-xr-xcontainer-disc/src/main/sh/vespa-start-container-daemon.sh31
1 files changed, 15 insertions, 16 deletions
diff --git a/container-disc/src/main/sh/vespa-start-container-daemon.sh b/container-disc/src/main/sh/vespa-start-container-daemon.sh
index 0c1f9da4739..77027e2a938 100755
--- a/container-disc/src/main/sh/vespa-start-container-daemon.sh
+++ b/container-disc/src/main/sh/vespa-start-container-daemon.sh
@@ -60,28 +60,27 @@ getconfig() {
}
configure_memory() {
- consider_fallback jvm_heapsize 1536
consider_fallback jvm_stacksize 512
consider_fallback jvm_baseMaxDirectMemorySize 75
consider_fallback jvm_directMemorySizeCache 0
- # 0 is default which should mean 100
- if (( jvm_heapSizeAsPercentageOfPhysicalMemory <= 0 )); then
- jvm_heapSizeAsPercentageOfPhysicalMemory=100
- fi
-
- if (( jvm_heapSizeAsPercentageOfPhysicalMemory != 100 || TOTAL_MEMORY_MB != 0 )); then
- if (( TOTAL_MEMORY_MB != 0 )); then
- available="$TOTAL_MEMORY_MB"
+ if ! varhasvalue jvm_heapsize; then
+ if varhasvalue jvm_heapSizeAsPercentageOfPhysicalMemory; then
+ if varhasvalue TOTAL_MEMORY_MB; then
+ available="$TOTAL_MEMORY_MB"
+ else
+ available=`free -m | grep Mem | tr -s ' ' | cut -f2 -d' '`
+ fi
+
+ jvm_heapsize=$[available * jvm_heapSizeAsPercentageOfPhysicalMemory / 100]
+ if (( jvm_heapsize < 1024 )); then
+ jvm_heapsize=1024
+ fi
else
- available=`free -m | grep Mem | tr -s ' ' | cut -f2 -d' '`
- fi
-
- jvm_heapsize=$[available * jvm_heapSizeAsPercentageOfPhysicalMemory / 100]
- if (( jvm_heapsize < 1024 )); then
- jvm_heapsize=1024
- fi
+ jvm_heapsize=1536
+ fi
fi
+
maxDirectMemorySize=$(( ${jvm_baseMaxDirectMemorySize} + ${jvm_heapsize}/8 + ${jvm_directMemorySizeCache} ))
memory_options="-Xms${jvm_heapsize}m -Xmx${jvm_heapsize}m"