bug5599: determine a default MEMORY value in env-default-rules.sh, considering the new TOTAL_MEMORY_SIZE_FACTOR variable

This commit is contained in:
Axel Uhl committed 2021-11-16 17:55:06 +01:00
1 parent 6d9e59bc8b
commit 380f403db3
2 files changed
+14 -2

No files matched your search

+13
View File
@@ -90,3 +90,16 @@ fi
if [ -z "${SERVER_STARTUP_NOTIFY}" ]; then
export SERVER_STARTUP_NOTIFY=simon.marcel.pamies@sap.com
fi
if [ -z "${MEMORY}" ]; then
MINIMUM_MEMORY_IN_MB=2000
MEM_TOTAL=`cat /proc/meminfo | grep MemTotal | awk '{print $2;}'`
MEMORY_FOR_APPLICATIONS=$(( ${MEM_TOTAL} / 1024 * 3 / 4 - 1500 / 1 ))
if [ -z "${TOTAL_MEMORY_SIZE_FACTOR}" ]; then
# All of the MEMORY_FOR_APPLICATIONS goes to this application
MEMORY_PER_INSTANCE_IN_MB=$(( ${MEMORY_FOR_APPLICATIONS} < ${MINIMUM_MEMORY_IN_MB} ? ${MINIMUM_MEMORY_IN_MB} : ${MEMORY_FOR_APPLICATIONS} ))
else
# Only a fraction (1/${TOTAL_MEMORY_SIZE_FACTOR}) goes to this application:
MEMORY_PER_INSTANCE_IN_MB=$(( ${MEMORY_FOR_APPLICATIONS} / ${TOTAL_MEMORY_SIZE_FACTOR} < ${MINIMUM_MEMORY_IN_MB} ? ${MINIMUM_MEMORY_IN_MB} : ${MEMORY_FOR_APPLICATIONS} / ${TOTAL_MEMORY_SIZE_FACTOR} ))
fi
export MEMORY="${MEMORY_PER_INSTANCE_IN_MB}m"
fi
+1 -2
View File
@@ -283,8 +283,7 @@ auto_install ()
# make sure to reload data, this time including defaults from release's env.sh, environment settings and user data
source `pwd`/env.sh
if [ -z $MEMORY ]; then
# Compute a default amount of memory based on available physical RAM and the number of applications, with a minimum of 2GB:
NUMBER_OF_INSTANCES=`echo "$JAVA_START_INSTANCES" | wc -w`
# Compute a default amount of memory based on available physical RAM, with a minimum of 2GB:
MINIMUM_MEMORY_IN_MB=2000
MEM_TOTAL=`cat /proc/meminfo | grep MemTotal | awk '{print $2;}'`
MEMORY_COMPUTED=$(( ${MEM_TOTAL} / 1024 * 3 / 4 - 1500 / 1 ))