diff --git a/distribution/bin/runbroker.cmd b/distribution/bin/runbroker.cmd index eab7e30f9d4522501a645684ba89249f6c47b920..d7f5083332fd30a948b977143a88ca9550a2e193 100644 --- a/distribution/bin/runbroker.cmd +++ b/distribution/bin/runbroker.cmd @@ -28,6 +28,12 @@ set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% rem =========================================================================================== rem JVM Configuration rem =========================================================================================== + +for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do @set "JAVA_VERSION=%%j" +if %JAVA_VERSION% EQU 1 goto java8- +goto java9+ + +:java8- set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g" set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:SurvivorRatio=8" set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:%USERPROFILE%\mq_gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" @@ -38,5 +44,16 @@ set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g" set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking" set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" set "JAVA_OPT=%JAVA_OPT% -cp %CLASSPATH%" +goto end +:java9+ +set "JAVA_OPT=%JAVA_OPT% --add-exports java.base/jdk.internal.ref=ALL-UNNAMED -server -Xms8g -Xmx8g -Xmn4g" +set "JAVA_OPT=%JAVA_OPT% -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" +set "JAVA_OPT=%JAVA_OPT% -Xlog:gc*=info,safepoint=debug:file=%USERPROFILE%\mq_gc.log:utctime,level,tags:filecount=5,filesize=30M" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:+AlwaysPreTouch" +set "JAVA_OPT=%JAVA_OPT% -XX:MaxDirectMemorySize=15g" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages -XX:-UseBiasedLocking" +set "JAVA_OPT=%JAVA_OPT% --class-path="%CLASSPATH%";"%BASE_DIR%lib\*"" +:end "%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/distribution/bin/runbroker.sh b/distribution/bin/runbroker.sh index 1d1000ee4ce43e3da8869f7261fbd82515492871..fa5b841e0a4655201fcf8e2c0d7ca0014735f877 100644 --- a/distribution/bin/runbroker.sh +++ b/distribution/bin/runbroker.sh @@ -64,18 +64,37 @@ choose_gc_log_directory() choose_gc_log_directory -JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" -JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" -JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${GC_LOG_DIR}/rmq_broker_gc_%p_%t.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" -JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" -JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" -JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" -JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=15g" -JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" -JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib:${JAVA_HOME}/lib/ext" -#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" -JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" -JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" +version=$($JAVA -version 2>&1 | awk -F '"' '/version/ {print $2}') +version=${version%.*.*} +if [[ "$version" -ge 9 ]]; then + JAVA_OPT="${JAVA_OPT} --add-exports java.base/jdk.internal.ref=ALL-UNNAMED -server -Xms8g -Xmx8g -Xmn4g" + JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" + JAVA_OPT="${JAVA_OPT} -Xlog:gc*=info,safepoint=debug:file=${GC_LOG_DIR}/rmq_broker_gc_%p_%t.log:utctime,level,tags:filecount=5,filesize=30M" + JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" + JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" + JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=15g" + JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" + JAVA_OPT="${JAVA_OPT} --class-path=${JAVA_HOME}/jre/lib/ext/*:${BASE_DIR}/lib/*:${CLASSPATH}:${JAVA_HOME}/lib/ext" + #JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" + JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +else + JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g" + JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" + JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${GC_LOG_DIR}/rmq_broker_gc_%p_%t.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintAdaptiveSizePolicy" + JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" + JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" + JAVA_OPT="${JAVA_OPT} -XX:+AlwaysPreTouch" + JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=15g" + JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages -XX:-UseBiasedLocking" + JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib:${JAVA_HOME}/lib/ext" + #JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" + JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" + JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" +fi + + + + numactl --interleave=all pwd > /dev/null 2>&1 if [ $? -eq 0 ] diff --git a/distribution/bin/runserver.cmd b/distribution/bin/runserver.cmd index 48e32bf2d7cb81eaeccfa5040b168bbd1af3847c..4abcbeb25cb86d1a55a75a7407ce9d352d866836 100644 --- a/distribution/bin/runserver.cmd +++ b/distribution/bin/runserver.cmd @@ -26,6 +26,11 @@ for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% +for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do @set "JAVA_VERSION=%%j" +if %JAVA_VERSION% EQU 1 goto java8- +goto java9+ + +:java8- set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" set "JAVA_OPT=%JAVA_OPT% -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" set "JAVA_OPT=%JAVA_OPT% -verbose:gc -Xloggc:"%USERPROFILE%\rmq_srv_gc.log" -XX:+PrintGCDetails" @@ -33,5 +38,13 @@ set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages" set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs=%BASE_DIR%lib" set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" +goto end +:java9+ +set "JAVA_OPT=%JAVA_OPT% --add-exports java.base/jdk.internal.ref=ALL-UNNAMED -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" +set "JAVA_OPT=%JAVA_OPT% -Xlog:gc*=info,safepoint=debug:file=%USERPROFILE%\rmq_srv_gc.log:utctime,level,tags:filecount=5,filesize=30M" +set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow" +set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages" +set "JAVA_OPT=%JAVA_OPT% --class-path="%CLASSPATH%";"%BASE_DIR%lib\*"" +:end "%JAVA%" %JAVA_OPT% %* \ No newline at end of file diff --git a/distribution/bin/runserver.sh b/distribution/bin/runserver.sh index 68fd1b46191f5cd0ec8130386d3b689db6456ad1..07fe635753c41592630e0c1653b8eccc8ff6b426 100644 --- a/distribution/bin/runserver.sh +++ b/distribution/bin/runserver.sh @@ -62,30 +62,30 @@ choose_gc_log_directory() esac } -choose_gc_options() -{ - # Example of JAVA_MAJOR_VERSION value : '1', '9', '10', '11', ... - # '1' means releases befor Java 9 - JAVA_MAJOR_VERSION=$("$JAVA" -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p') - if [[ "$JAVA_MAJOR_VERSION" -lt "9" ]] ; then - JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" - JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log -XX:+PrintGCDetails" - JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" - else - JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m -XX:G1ReservePercent=25 -XX:InitiatingHeapOccupancyPercent=30 -XX:SoftRefLRUPolicyMSPerMB=0" - JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log:time,tags:filecount=5,filesize=30M" - fi -} +version=$($JAVA -version 2>&1 | awk -F '"' '/version/ {print $2}') +version=${version%.*.*} +if [[ "$version" -ge 9 ]]; then + JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" + JAVA_OPT="${JAVA_OPT} -XX:SurvivorRatio=8" + JAVA_OPT="${JAVA_OPT} -Xlog:gc*=info,safepoint=debug:file=${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log:utctime,level,tags:filecount=5,filesize=30M" + JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" + JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" + JAVA_OPT="${JAVA_OPT} --class-path=${JAVA_HOME}/jre/lib/ext/*:${BASE_DIR}/lib/*:${CLASSPATH}" + #JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" + JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" +else + JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" + JAVA_OPT="${JAVA_OPT} -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSInitiatingOccupancyFraction=70 -XX:+CMSParallelRemarkEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSClassUnloadingEnabled -XX:SurvivorRatio=8 -XX:-UseParNewGC" + JAVA_OPT="${JAVA_OPT} -verbose:gc -Xloggc:${GC_LOG_DIR}/rmq_srv_gc_%p_%t.log -XX:+PrintGCDetails" + JAVA_OPT="${JAVA_OPT} -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=30m" + JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" + JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" + JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib" + #JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" + JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" + JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" +fi -choose_gc_log_directory -JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m" -choose_gc_options -JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow" -JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages" -JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${BASE_DIR}/lib:${JAVA_HOME}/lib/ext" -#JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n" -JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}" -JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" $JAVA ${JAVA_OPT} $@ diff --git a/distribution/bin/tools.cmd b/distribution/bin/tools.cmd index c61fbcf8a472b49a815c0d1121ef17614652cf0d..c0b601b2e0c77dce73a82a6928fa5838d28f1965 100644 --- a/distribution/bin/tools.cmd +++ b/distribution/bin/tools.cmd @@ -25,11 +25,22 @@ for %%d in (%BASE_DIR%) do set BASE_DIR=%%~dpd set CLASSPATH=.;%BASE_DIR%conf;%CLASSPATH% +for /f tokens^=2-5^ delims^=.-_^" %%j in ('java -fullversion 2^>^&1') do @set "JAVA_VERSION=%%j" +if %JAVA_VERSION% EQU 1 goto java8- +goto java9+ + rem =========================================================================================== rem JVM Configuration rem =========================================================================================== + +:java8- set "JAVA_OPT=%JAVA_OPT% -server -Xms1g -Xmx1g -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m" set "JAVA_OPT=%JAVA_OPT% -Djava.ext.dirs="%BASE_DIR%\lib";"%JAVA_HOME%\jre\lib\ext";"%JAVA_HOME%\lib\ext"" set "JAVA_OPT=%JAVA_OPT% -cp "%CLASSPATH%"" +goto end +:java9+ +set "JAVA_OPT=%JAVA_OPT% --add-exports java.base/jdk.internal.ref=ALL-UNNAMED -server -Xms1g -Xmx1g -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m" +set "JAVA_OPT=%JAVA_OPT% --class-path="%CLASSPATH%";"%BASE_DIR%\lib\*";"%JAVA_HOME%\jre\lib\ext";"%JAVA_HOME%\lib\ext"" +:end -"%JAVA%" %JAVA_OPT% %* +"%JAVA%" %JAVA_OPT% -version diff --git a/distribution/bin/tools.sh b/distribution/bin/tools.sh index a13dc7e620aa3717cb8ea31a8ee06f28e07d1123..cfe0eb35fd6cf0091d07d7faf4449017c010540e 100644 --- a/distribution/bin/tools.sh +++ b/distribution/bin/tools.sh @@ -36,8 +36,17 @@ export CLASSPATH=.:${BASE_DIR}/conf:${CLASSPATH} #=========================================================================================== # JVM Configuration #=========================================================================================== -JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m" -JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext" -JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" + +version=$($JAVA -version 2>&1 | awk -F '"' '/version/ {print $2}') +version=${version%.*.*} + +if [[ "$version" -ge 9 ]]; then + JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m" + JAVA_OPT="${JAVA_OPT} --class-path=${JAVA_HOME}/jre/lib/ext/*:${BASE_DIR}/lib/*:${CLASSPATH}" +else + JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m" + JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${BASE_DIR}/lib:${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext" + JAVA_OPT="${JAVA_OPT} -cp ${CLASSPATH}" +fi $JAVA ${JAVA_OPT} "$@"