From 71c26b9ca5368f7cd58e100ac70a00cb8f93bf28 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Tue, 3 Nov 2020 23:11:13 +0100 Subject: [PATCH] when computed max heap size for process is under a threshold (2g), set to threshold --- configuration/sailing | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configuration/sailing b/configuration/sailing index b6e938465e3..121187de88e 100755 --- a/configuration/sailing +++ b/configuration/sailing @@ -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