Skip to content

Commit

Permalink
[SMALLFIX] Use better defaults for JVM memory sizes (#6938)
Browse files Browse the repository at this point in the history
* [SMALLFIX] Use better defaults for JVM memory sizes

* [SMALLFIX] Fix comment
  • Loading branch information
gpang authored and apc999 committed Mar 6, 2018
1 parent ee5dea8 commit 9c3559e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions bin/alluxio-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ ensure_dirs() {
fi
}

# returns 1 if "$1" contains "$2", 0 otherwise.
contains() {
if [[ "$1" = *"$2"* ]]; then
return 1
fi
return 0
}

get_env() {
DEFAULT_LIBEXEC_DIR="${BIN}"/../libexec
ALLUXIO_LIBEXEC_DIR=${ALLUXIO_LIBEXEC_DIR:-${DEFAULT_LIBEXEC_DIR}}
Expand Down Expand Up @@ -162,6 +170,12 @@ start_master() {
ALLUXIO_SECONDARY_MASTER_JAVA_OPTS=${ALLUXIO_JAVA_OPTS}
fi

# use a default Xmx value for the master
contains "${ALLUXIO_SECONDARY_MASTER_JAVA_OPTS}" "Xmx"
if [[ $? -eq 0 ]]; then
ALLUXIO_SECONDARY_MASTER_JAVA_OPTS+=" -Xmx8g "
fi

echo "Starting secondary master @ $(hostname -f). Logging to ${ALLUXIO_LOGS_DIR}"
(nohup "${JAVA}" -cp ${CLASSPATH} \
${ALLUXIO_SECONDARY_MASTER_JAVA_OPTS} \
Expand All @@ -171,6 +185,12 @@ start_master() {
ALLUXIO_MASTER_JAVA_OPTS=${ALLUXIO_JAVA_OPTS}
fi

# use a default Xmx value for the master
contains "${ALLUXIO_MASTER_JAVA_OPTS}" "Xmx"
if [[ $? -eq 0 ]]; then
ALLUXIO_MASTER_JAVA_OPTS+=" -Xmx8g "
fi

echo "Starting master @ $(hostname -f). Logging to ${ALLUXIO_LOGS_DIR}"
(nohup "${JAVA}" -cp ${CLASSPATH} \
${ALLUXIO_MASTER_JAVA_OPTS} \
Expand Down Expand Up @@ -209,6 +229,18 @@ start_worker() {
ALLUXIO_WORKER_JAVA_OPTS=${ALLUXIO_JAVA_OPTS}
fi

# use a default Xmx value for the worker
contains "${ALLUXIO_WORKER_JAVA_OPTS}" "Xmx"
if [[ $? -eq 0 ]]; then
ALLUXIO_WORKER_JAVA_OPTS+=" -Xmx4g "
fi

# use a default MaxDirectMemorySize value for the worker
contains "${ALLUXIO_WORKER_JAVA_OPTS}" "XX:MaxDirectMemorySize"
if [[ $? -eq 0 ]]; then
ALLUXIO_WORKER_JAVA_OPTS+=" -XX:MaxDirectMemorySize=4g "
fi

echo "Starting worker @ $(hostname -f). Logging to ${ALLUXIO_LOGS_DIR}"
(nohup "${JAVA}" -cp ${CLASSPATH} \
${ALLUXIO_WORKER_JAVA_OPTS} \
Expand Down

0 comments on commit 9c3559e

Please sign in to comment.