Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gateway): Set default JVM options #131

Merged
merged 1 commit into from
Jan 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@ if [ ! -f "$runjar" ]; then
fi
GRAVITEE_BOOT_CLASSPATH="$runjar"

if [ "x$GIO_MIN_MEM" = "x" ]; then
GIO_MIN_MEM=512m
fi
if [ "x$GIO_MAX_MEM" = "x" ]; then
GIO_MAX_MEM=512m
fi

# min and max heap sizes should be set to the same value to avoid
# stop-the-world GC pauses during resize
JAVA_OPTS="$JAVA_OPTS -Xms${GIO_MIN_MEM}"
JAVA_OPTS="$JAVA_OPTS -Xmx${GIO_MAX_MEM}"

# set to headless, just in case
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"

# Force the JVM to use IPv4 stack
if [ "x$GIO_USE_IPV4" != "x" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
fi

# Causes the JVM to dump its heap on OutOfMemory.
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
# The path to the heap dump location, note directory must exists and have enough
# space for a full heap dump.
#JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$GRAVITEE_HOME/logs/heapdump.hprof"

# Disables explicit GC
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"

# Ensure UTF-8 encoding by default (e.g. filenames)
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"

# Display our environment
echo "========================================================================="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,37 @@ for /f %%i in ('dir ..\lib\gravitee-gateway-standalone-bootstrap*.jar /s /b') do

set GRAVITEE_BOOT_CLASSPATH=%runjar%

if "%GIO_MIN_MEM%" == "" (
set GIO_MIN_MEM=512m
)

if "%GIO_MAX_MEM%" == "" (
set GIO_MAX_MEM=512m
)

REM min and max heap sizes should be set to the same value to avoid
REM stop-the-world GC pauses during resize
set JAVA_OPTS=%JAVA_OPTS% -Xms%GIO_MIN_MEM% -Xmx%GIO_MAX_MEM%

REM set to headless, just in case
set JAVA_OPTS=%JAVA_OPTS% -Djava.awt.headless=true

REM Force the JVM to use IPv4 stack
if NOT "%ES_USE_IPV4%" == "" (
set JAVA_OPTS=%JAVA_OPTS% -Djava.net.preferIPv4Stack=true
)

REM Causes the JVM to dump its heap on OutOfMemory.
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
REM The path to the heap dump location, note directory must exists and have enough
REM space for a full heap dump.
REM set JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$GRAVITEE_HOME/logs/heapdump.hprof

REM Disables explicit GC
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC

REM Ensure UTF-8 encoding by default (e.g. filenames)
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8

# Display our environment
echo "========================================================================="
Expand Down