Skip to content

Commit

Permalink
Respect MaxRamPercentage in container
Browse files Browse the repository at this point in the history
Currently if user specifies `MaxRamPercentage` without specifying `Xmx`,
Alluxio still gives a defualt `Xmx` which will override the
`MaxRamPercentage` because of priority. Fix this by if user specifies
`MaxRamPercentage` we don't give a default `Xmx`.

First step of solving #10083
Replace #15819

pr-link: #16940
change-id: cid-8f52b90408f6d3a2ba8ee0cf6c623fd85e6b9e15
  • Loading branch information
ssz1997 committed Feb 28, 2023
1 parent db462bd commit 492cc7c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions bin/launch-process
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ USAGE+="
contains() {
if [[ "$1" = *"$2"* ]]; then
printf "1"
else
printf "0"
fi
printf "0"
}

# Sets environment variables by sourcing ${ALLUXIO_HOME}/libexec/alluxio-config.sh
Expand Down Expand Up @@ -124,8 +125,9 @@ launch_master() {
fi

# use a default Xmx value for the master
local res="$(contains "${ALLUXIO_MASTER_JAVA_OPTS}" "Xmx")"
if [[ "${res}" -eq "0" ]]; then
local contain_xmx="$(contains "${ALLUXIO_MASTER_JAVA_OPTS}")"
local contain_max_percentage="$(contains "${ALLUXIO_MASTER_JAVA_OPTS}" "MaxRAMPercentage")"
if [[ "${contain_xmx}" -eq "0" ]] && [[ "${contain_max_percentage}" -eq "0" ]]; then
ALLUXIO_MASTER_JAVA_OPTS+=" -Xmx8g "
fi
# use a default MetaspaceSize value for the master
Expand All @@ -142,8 +144,9 @@ launch_master() {
# Launch a secondary master process
launch_secondary_master() {
# use a default Xmx value for the master
local res="$(contains "${ALLUXIO_SECONDARY_MASTER_JAVA_OPTS}" "Xmx")"
if [[ "${res}" -eq "0" ]]; then
local contain_xmx="$(contains "${ALLUXIO_SECONDARY_MASTER_JAVA_OPTS}")"
local contain_max_percentage="$(contains "${ALLUXIO_SECONDARY_MASTER_JAVA_OPTS}" "MaxRAMPercentage")"
if [[ "${contain_xmx}" -eq "0" ]] && [[ "${contain_max_percentage}" -eq "0" ]]; then
ALLUXIO_SECONDARY_MASTER_JAVA_OPTS+=" -Xmx8g "
fi
launch_process "${ALLUXIO_SECONDARY_MASTER_ATTACH_OPTS}" \
Expand All @@ -161,8 +164,9 @@ launch_job_master() {
# Launch a worker process
launch_worker() {
# use a default Xmx value for the worker
local res="$(contains "${ALLUXIO_WORKER_JAVA_OPTS}" "Xmx")"
if [[ "${res}" -eq "0" ]]; then
local contain_xmx="$(contains "${ALLUXIO_WORKER_JAVA_OPTS}")"
local contain_max_percentage="$(contains "${ALLUXIO_WORKER_JAVA_OPTS}" "MaxRAMPercentage")"
if [[ "${contain_xmx}" -eq "0" ]] && [[ "${contain_max_percentage}" -eq "0" ]]; then
ALLUXIO_WORKER_JAVA_OPTS+=" -Xmx4g "
fi

Expand Down

0 comments on commit 492cc7c

Please sign in to comment.