diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh index 151465ec6d..b5d5346f34 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh @@ -101,14 +101,20 @@ fi # Using G1GC as the default garbage collector (Recommended for large memory machines) case "$GC_OPTION" in - g1) + "") echo "Using G1GC as the default garbage collector" - JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseG1GC -XX:+ParallelRefProcEnabled \ + JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+ParallelRefProcEnabled \ -XX:InitiatingHeapOccupancyPercent=50 -XX:G1RSetUpdatingPauseTimePercent=5" ;; - "") ;; + zgc|ZGC) + echo "Using ZGC as the default garbage collector (Only support Java 11+)" + JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseZGC -XX:+UnlockExperimentalVMOptions \ + -XX:ConcGCThreads=2 -XX:ParallelGCThreads=6 \ + -XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5 \ + -XX:+UnlockDiagnosticVMOptions -XX:-ZProactive" + ;; *) - echo "Unrecognized gc option: '$GC_OPTION', only support 'g1' now" >> ${OUTPUT} + echo "Unrecognized gc option: '$GC_OPTION', default use g1, options only support 'ZGC' now" >> ${OUTPUT} exit 1 esac diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh index 8b6a16d5ad..857b9b5356 100644 --- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh +++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/hugegraph-server.sh @@ -121,9 +121,9 @@ fi # Using G1GC as the default garbage collector (Recommended for large memory machines) # mention: zgc is only available on ARM-Mac with java > 13 case "$GC_OPTION" in - g1|G1|g1gc) + "") echo "Using G1GC as the default garbage collector" - JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseG1GC -XX:+ParallelRefProcEnabled \ + JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+ParallelRefProcEnabled \ -XX:InitiatingHeapOccupancyPercent=50 \ -XX:G1RSetUpdatingPauseTimePercent=5" ;; @@ -134,9 +134,8 @@ case "$GC_OPTION" in -XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5 \ -XX:+UnlockDiagnosticVMOptions -XX:-ZProactive" ;; - "") ;; *) - echo "Unrecognized gc option: '$GC_OPTION', only support 'G1/ZGC' now" >> ${OUTPUT} + echo "Unrecognized gc option: '$GC_OPTION', default use g1, options only support 'ZGC' now" >> ${OUTPUT} exit 1 esac diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh index d70f2fbd13..d8b965a07d 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh @@ -144,7 +144,7 @@ if [ "$JAVA_OPTIONS" = "" ]; then >> ${OUTPUT} exit 1 fi - JAVA_OPTIONS="-Xms${MIN_MEM}m -Xmx${XMX}m -XX:MetaspaceSize=256M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGS} ${USER_OPTION} " + JAVA_OPTIONS="-Xms${MIN_MEM}m -Xmx${XMX}m -XX:MetaspaceSize=256M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGS} ${USER_OPTION} " # JAVA_OPTIONS="-Xms${MIN_MEM}m -Xmx${XMX}m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGS} ${USER_OPTION}" # Rolling out detailed GC logs @@ -153,14 +153,20 @@ fi # Using G1GC as the default garbage collector (Recommended for large memory machines) case "$GC_OPTION" in - g1) + "") echo "Using G1GC as the default garbage collector" - JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseG1GC -XX:+ParallelRefProcEnabled \ + JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+ParallelRefProcEnabled \ -XX:InitiatingHeapOccupancyPercent=50 -XX:G1RSetUpdatingPauseTimePercent=5" ;; - "") ;; + zgc|ZGC) + echo "Using ZGC as the default garbage collector (Only support Java 11+)" + JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseZGC -XX:+UnlockExperimentalVMOptions \ + -XX:ConcGCThreads=2 -XX:ParallelGCThreads=6 \ + -XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5 \ + -XX:+UnlockDiagnosticVMOptions -XX:-ZProactive" + ;; *) - echo "Unrecognized gc option: '$GC_OPTION', only support 'g1' now" >> ${OUTPUT} + echo "Unrecognized gc option: '$GC_OPTION', default use g1, options only support 'ZGC' now" >> ${OUTPUT} exit 1 esac