when computed max heap size for process is under a threshold (2g), set to threshold

This commit is contained in:
Axel Uhl committed 2020-11-03 23:11:13 +01:00
1 parent d16ed4d233
commit 71c26b9ca5
1 file changed
+4 -1
+4 -1
View File
@@ -43,7 +43,10 @@ start_servers() {
else
echo "No image-upgrade request found in EC2 user data $($EC2_METADATA_CMD -d); proceding with regular server launch..." >>/var/log/sailing.err
NUMBER_OF_INSTANCES=`echo "$JAVA_START_INSTANCES" | wc -w`
MEMORY_PER_INSTANCE_IN_MB=`cat /proc/meminfo | grep MemTotal | awk '{printf("%i\n", ($2 / 1024 * 0.75 - 1500) / '$NUMBER_OF_INSTANCES' );}'`
MINIMUM_MEMORY_IN_MB=2000
MEM_TOTAL=`cat /proc/meminfo | grep MemTotal | awk '{print $2;}'`
MEMORY_COMPUTED=$(( ${MEM_TOTAL} / 1024 * 3 / 4 - 1500 / 1 ))
MEMORY_PER_INSTANCE_IN_MB=$(( $MEMORY_COMPUTED < $MINIMUM_MEMORY_IN_MB ? $MINIMUM_MEMORY_IN_MB : $MEMORY_COMPUTED ))
echo "Using ${MEMORY_PER_INSTANCE_IN_MB}MB as default heap size per instance."
for conf in $JAVA_START_INSTANCES; do
echo "Checking for amazon update..." >>/var/log/sailing.out