summaryrefslogtreecommitdiffstats
path: root/vespabase
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-06-16 08:27:22 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-06-16 08:27:22 +0000
commitff9785791affddb70748738bc38eb6a0610be9a2 (patch)
tree188e68046b40a6f40e7978fb44ca2d22a7d23faa /vespabase
parent28b57f1d58d2af4580cd41a9d2e08b5af63590b8 (diff)
Also consider heap overrides when controlling THP for jvms.
Diffstat (limited to 'vespabase')
-rwxr-xr-xvespabase/src/common-env.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/vespabase/src/common-env.sh b/vespabase/src/common-env.sh
index 7b812d40fec..b64de704d85 100755
--- a/vespabase/src/common-env.sh
+++ b/vespabase/src/common-env.sh
@@ -158,6 +158,37 @@ get_jvm_hugepage_settings() {
echo "$options"
}
+get_heap_size() {
+ param=$1
+ args=$2
+ value=$3
+ for token in $args
+ do
+ [[ "$token" =~ ^"${param}"([0-9]+)(.)$ ]] || continue
+ size="${BASH_REMATCH[1]}"
+ unit="${BASH_REMATCH[2],,}" # lower-case
+ case "$unit" in
+ k) value=$(( $size / 1024 )) ;;
+ m) value="$size" ;;
+ g) value=$(( $size * 1024 )) ;;
+ *) echo "Warning: Invalid unit in '$token'" >&2 ;;
+ esac
+ done
+ echo "$value"
+}
+
+get_min_heap_mb() {
+ args=$1
+ size=$2
+ get_heap_size "-Xms" "$args" $size
+}
+
+get_max_heap_mb() {
+ args=$1
+ size=$2
+ get_heap_size "-Xmx" "$args" $size
+}
+
populate_environment
export LD_LIBRARY_PATH=$VESPA_HOME/lib64