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

SOLR-17531: Use new unified GC log options #2815

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion solr/benchmark/jmh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ echo "running JMH with args: $@"
# MRM: I've also seen 15 claimed as a sweet spot.

jvmArgs="-jvmArgs -Djmh.shutdownTimeout=5 -jvmArgs -Djmh.shutdownTimeout.step=3 -jvmArgs -Djava.security.egd=file:/dev/./urandom -jvmArgs -XX:+UnlockDiagnosticVMOptions -jvmArgs -XX:+DebugNonSafepoints -jvmArgs --add-opens=java.base/java.lang.reflect=ALL-UNNAMED"
gcArgs="-jvmArgs -XX:+UseG1GC -jvmArgs -XX:+ParallelRefProcEnabled"
gcArgs="-jvmArgs -XX:+ParallelRefProcEnabled"

# -jvmArgs -Dlog4j2.debug
loggingArgs="-jvmArgs -Dlog4jConfigurationFile=./log4j2-bench.xml -jvmArgs -Dlog4j2.is.webapp=false -jvmArgs -Dlog4j2.garbagefreeThreadContextMap=true -jvmArgs -Dlog4j2.enableDirectEncoders=true -jvmArgs -Dlog4j2.enable.threadlocals=true"
Expand Down
24 changes: 3 additions & 21 deletions solr/bin/solr
Original file line number Diff line number Diff line change
Expand Up @@ -1054,26 +1054,9 @@ if [[ -n ${SOLR_DATA_HOME:-} ]] && [ ! -e "$SOLR_DATA_HOME" ]; then
exit 1
fi

# Establish default GC logging opts if no env var set (otherwise init to sensible default)
# Establish default GC logging opts if no env var set
if [ -z "${GC_LOG_OPTS}" ]; then
GC_LOG_OPTS=('-Xlog:gc*')
fi

# if verbose gc logging enabled, setup the location of the log file and rotation
if [ "${#GC_LOG_OPTS[@]}" -gt 0 ]; then
if [ "$JAVA_VENDOR" == "OpenJ9" ]; then
GC_LOG_OPTS+=("-Xverbosegclog:$SOLR_LOGS_DIR/solr_gc.log" '-XX:+UseGCLogFileRotation' '-XX:NumberOfGCLogFiles=9' '-XX:GCLogFileSize=20M')
else
# https://openjdk.java.net/jeps/158
for i in "${!GC_LOG_OPTS[@]}";
do
# for simplicity, we only look at the prefix '-Xlog:gc'
# (if 'all' or multiple tags are used starting with anything other then 'gc' the user is on their own)
# if a single additional ':' exists in param, then there is already an explicit output specifier
# shellcheck disable=SC2001
GC_LOG_OPTS[$i]=$(echo "${GC_LOG_OPTS[$i]}" | sed "s|^\(-Xlog:gc[^:]*$\)|\1:file=$SOLR_LOGS_DIR/solr_gc.log:time,uptime:filecount=9,filesize=20M|")
done
fi
GC_LOG_OPTS=("-Xlog:gc*:file=$SOLR_LOGS_DIR\solr_gc.log:time,level,tags:filecount=9,filesize=20M")
fi

if [ "${SOLR_MODE:-}" == 'solrcloud' ]; then
Expand Down Expand Up @@ -1204,8 +1187,7 @@ function start_solr() {

# define default GC_TUNE
if [ -z "${GC_TUNE}" ]; then
GC_TUNE_ARR=('-XX:+UseG1GC' \
'-XX:+PerfDisableSharedMem' \
GC_TUNE_ARR=('-XX:+PerfDisableSharedMem' \
'-XX:+ParallelRefProcEnabled' \
'-XX:MaxGCPauseMillis=250' \
'-XX:+UseLargePages' \
Expand Down
5 changes: 2 additions & 3 deletions solr/bin/solr.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -973,8 +973,7 @@ set SCRIPT_SOLR_OPTS=%SOLR_JAVA_STACK_SIZE% %SCRIPT_SOLR_OPTS%
IF "%SOLR_TIMEZONE%"=="" set SOLR_TIMEZONE=UTC

IF "%GC_TUNE%"=="" (
set GC_TUNE=-XX:+UseG1GC ^
-XX:+PerfDisableSharedMem ^
set GC_TUNE=-XX:+PerfDisableSharedMem ^
-XX:+ParallelRefProcEnabled ^
-XX:MaxGCPauseMillis=250 ^
-XX:+UseLargePages ^
Expand All @@ -986,7 +985,7 @@ REM Add vector optimizations module
set SCRIPT_SOLR_OPTS=%SCRIPT_SOLR_OPTS% --add-modules jdk.incubator.vector

IF "%GC_LOG_OPTS%"=="" (
set GC_LOG_OPTS="-Xlog:gc*"
set GC_LOG_OPTS="-Xlog:gc*:file=!SOLR_LOGS_DIR!\solr_gc.log:time,level,tags:filecount=9,filesize=20M"
)

IF "%verbose%"=="1" (
Expand Down
5 changes: 2 additions & 3 deletions solr/bin/solr.in.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ REM Increase Java Min/Max Heap as needed to support your indexing / query needs
REM set SOLR_JAVA_MEM=-Xms512m -Xmx512m

REM Configure verbose GC logging:
REM For Java 8: if this is set, additional params will be added to specify the log file & rotation
REM For Java 9 or higher: GC_LOG_OPTS is currently not supported unless you are using OpenJ9. Otherwise if you set it, the startup script will exit with failure.
REM set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime
REM Settings this value overrides the default configuration.
REM set GC_LOG_OPTS=-Xlog:gc*:time,level,tags,heap,tenuring,stop:filecount=9,filesize=20M

REM Various GC settings have shown to work well for a number of common Solr workloads.
REM See solr.cmd GC_TUNE for the default list.
Expand Down
10 changes: 2 additions & 8 deletions solr/bin/solr.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,9 @@
#SOLR_JAVA_MEM="-Xms512m -Xmx512m"

# Enable verbose GC logging...
# * If this is unset, various default options will be selected depending on which JVM version is in use
# * For Java 8: if this is set, additional params will be added to specify the log file & rotation
# * For Java 9 or higher: each included opt param that starts with '-Xlog:gc', but does not include an
# output specifier, will have a 'file' output specifier (as well as formatting & rollover options)
# appended, using the effective value of the SOLR_LOGS_DIR.
# If this is unset, various default options will be selected depending on which JVM version is in use
#
#GC_LOG_OPTS='-Xlog:gc*' # (Java 9+)
#GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \
# -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime"
#GC_LOG_OPTS='-Xlog:gc*:time,level,tags,heap,tenuring,stop:filecount=9,filesize=20M'

# These GC settings have shown to work well for a number of common Solr workloads
#GC_TUNE=" \
Expand Down
7 changes: 0 additions & 7 deletions solr/cross-dc-manager/bin/cross-dc-manager
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ else
JAVA_MEM_OPTS="-Xms$JAVA_HEAP -Xmx$JAVA_HEAP"
fi

# define default GC_TUNE
if [ -z ${GC_TUNE+x} ]; then
GC_TUNE='-XX:+UseG1GC'
else
GC_TUNE="$GC_TUNE"
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
Expand Down
1 change: 0 additions & 1 deletion solr/cross-dc-manager/bin/cross-dc-manager.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ set BASEDIR=%~dp0..

IF NOT "%JAVA_HEAP%"=="" set JAVA_MEM=-Xms%JAVA_HEAP% -Xmx%JAVA_HEAP%
IF "%JAVA_MEM%"=="" set JAVA_MEM=-Xms512m -Xmx512m
IF "%GC_TUNE%"=="" set GC_TUNE=-XX:+UseG1GC

if "%JAVACMD%"=="" set JAVACMD=java

Expand Down
7 changes: 0 additions & 7 deletions solr/prometheus-exporter/bin/solr-exporter
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,6 @@ else
JAVA_MEM_OPTS="-Xms$JAVA_HEAP -Xmx$JAVA_HEAP"
fi

# define default GC_TUNE
if [ -z ${GC_TUNE+x} ]; then
GC_TUNE='-XX:+UseG1GC'
else
GC_TUNE="$GC_TUNE"
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
Expand Down
1 change: 0 additions & 1 deletion solr/prometheus-exporter/bin/solr-exporter.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ set BASEDIR=%~dp0..

IF NOT "%JAVA_HEAP%"=="" set JAVA_MEM=-Xms%JAVA_HEAP% -Xmx%JAVA_HEAP%
IF "%JAVA_MEM%"=="" set JAVA_MEM=-Xms512m -Xmx512m
IF "%GC_TUNE%"=="" set GC_TUNE=-XX:+UseG1GC

if "%JAVACMD%"=="" set JAVACMD=java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ curl http://localhost:8983/solr/admin/info/system
"classpath":"start.jar",
"commandLineArgs":["-Xms512m",
"-Xmx512m",
"-XX:+UseG1GC",
"-XX:+PerfDisableSharedMem",
"-XX:+ParallelRefProcEnabled",
"-XX:MaxGCPauseMillis=250",
Expand Down Expand Up @@ -284,7 +283,6 @@ curl http://localhost:8983/solr/gettingstarted/admin/system
"classpath":"start.jar",
"commandLineArgs":["-Xms512m",
"-Xmx512m",
"-XX:+UseG1GC",
"-XX:+PerfDisableSharedMem",
"-XX:+ParallelRefProcEnabled",
"-XX:MaxGCPauseMillis=250",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ This is ignored if `JAVA_HEAP` is provided.
+
[%autowidth,frame=none]
|===
|Optional |Default: `-XX:+UseG1GC`
|Optional |Default: none
|===
+
Custom Java garbage collection settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ The status command should give some basic information about the running Solr nod
Tasks: 41 (limit: 25056)
Memory: 517.1M
CGroup: /system.slice/solr.service
└─3708 java -server -Xms256M -Xmx512M -XX:+UseG1GC -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250 -XX:+UseLargePages -XX:+AlwaysPreTouch -Xlog:gc*:file=/var/solr/logs/solr_gc.log:time,...
└─3708 java -server -Xms256M -Xmx512M -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250 -XX:+UseLargePages -XX:+AlwaysPreTouch -Xlog:gc*:file=/var/solr/logs/solr_gc.log:time,...
Apr 16 20:41:47 localhost.localdomain systemd[1]: Starting Apache Solr...
Apr 16 20:42:01 localhost.localdomain solr[3661]: [326B blob data]
Apr 16 20:42:01 localhost.localdomain solr[3661]: Started Solr server on port 8983 (pid=3708). Happy searching!
Expand Down
Loading