mirror of https://github.com/apache/lucene.git
SOLR-6705: Add specific JVM version checking to Windows start scripts
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1638429 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5240a5ac8a
commit
fe6eff7d1b
|
@ -989,7 +989,7 @@ function launch_solr() {
|
|||
SOLR_ADDL_ARGS="$2"
|
||||
|
||||
# deal with Java version specific GC and other flags
|
||||
JAVA_VERSION=`echo "$(java -version 2>&1)" | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
|
||||
JAVA_VERSION=`echo "$($JAVA -version 2>&1)" | grep "java version" | awk '{ print substr($3, 2, length($3)-2); }'`
|
||||
if [ "${JAVA_VERSION:0:3}" == "1.7" ]; then
|
||||
# Specific Java version hacking
|
||||
GC_TUNE="$GC_TUNE -XX:CMSFullGCsBeforeCompaction=1 -XX:CMSTriggerPermRatio=80"
|
||||
|
|
|
@ -604,6 +604,32 @@ IF NOT "%SOLR_HEAP%"=="" set SOLR_JAVA_MEM=-Xms%SOLR_HEAP% -Xmx%SOLR_HEAP%
|
|||
IF "%SOLR_JAVA_MEM%"=="" set SOLR_JAVA_MEM=-Xms512m -Xmx512m
|
||||
IF "%SOLR_TIMEZONE%"=="" set SOLR_TIMEZONE=UTC
|
||||
|
||||
@REM Add Java version specific flags if needed
|
||||
set JAVAVER=
|
||||
set JAVA_MAJOR=
|
||||
set JAVA_BUILD=0
|
||||
|
||||
"%JAVA%" -version 2>&1 | findstr /i "version" > javavers
|
||||
set /p JAVAVEROUT=<javavers
|
||||
del javavers
|
||||
for /f "tokens=3" %%g in ("!JAVAVEROUT!") do (
|
||||
set JAVAVER=%%g
|
||||
set JAVAVER=!JAVAVER:"=!
|
||||
for /f "delims=_ tokens=1-3" %%v in ("!JAVAVER!") do (
|
||||
set JAVA_MAJOR=!JAVAVER:~0,3!
|
||||
set /a JAVA_BUILD=%%w
|
||||
)
|
||||
)
|
||||
IF "!JAVA_MAJOR!"=="1.7" (
|
||||
set "GC_TUNE=%GC_TUNE% -XX:CMSFullGCsBeforeCompaction=1 -XX:CMSTriggerPermRatio=80"
|
||||
IF !JAVA_BUILD! GEQ 40 (
|
||||
IF !JAVA_BUILD! LEQ 51 (
|
||||
set "GC_TUNE=!GC_TUNE! -XX:-UseSuperWord"
|
||||
@echo WARNING: Java version !JAVAVER! has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
IF "%verbose%"=="1" (
|
||||
@echo Starting Solr using the following settings:
|
||||
@echo JAVA = %JAVA%
|
||||
|
@ -611,7 +637,7 @@ IF "%verbose%"=="1" (
|
|||
@echo SOLR_HOME = %SOLR_HOME%
|
||||
@echo SOLR_HOST = %SOLR_HOST%
|
||||
@echo SOLR_PORT = %SOLR_PORT%
|
||||
@echo GC_TUNE = %GC_TUNE%
|
||||
@echo GC_TUNE = !GC_TUNE!
|
||||
@echo GC_LOG_OPTS = %GC_LOG_OPTS%
|
||||
@echo SOLR_JAVA_MEM = %SOLR_JAVA_MEM%
|
||||
@echo REMOTE_JMX_OPTS = %REMOTE_JMX_OPTS%
|
||||
|
@ -626,7 +652,7 @@ IF "%verbose%"=="1" (
|
|||
)
|
||||
|
||||
set START_OPTS=-Duser.timezone=%SOLR_TIMEZONE% -Djava.net.preferIPv4Stack=true
|
||||
set START_OPTS=%START_OPTS% %GC_TUNE% %GC_LOG_OPTS%
|
||||
set START_OPTS=%START_OPTS% !GC_TUNE! %GC_LOG_OPTS%
|
||||
IF NOT "!CLOUD_MODE_OPTS!"=="" set START_OPTS=%START_OPTS% !CLOUD_MODE_OPTS!
|
||||
IF NOT "%REMOTE_JMX_OPTS%"=="" set START_OPTS=%START_OPTS% %REMOTE_JMX_OPTS%
|
||||
IF NOT "%SOLR_ADDL_ARGS%"=="" set START_OPTS=%START_OPTS% %SOLR_ADDL_ARGS%
|
||||
|
|
|
@ -22,14 +22,13 @@ REM affecting other Java applications on your server/workstation.
|
|||
REM set SOLR_JAVA_HOME=
|
||||
|
||||
REM Increase Java Min/Max Heap as needed to support your indexing / query needs
|
||||
set SOLR_JAVA_MEM=-Xms512m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=256m
|
||||
set SOLR_JAVA_MEM=-Xms512m -Xmx512m
|
||||
|
||||
REM Enable verbose GC logging
|
||||
set GC_LOG_OPTS=-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime
|
||||
|
||||
REM These GC settings have shown to work well for a number of common Solr workloads
|
||||
set GC_TUNE=-XX:-UseSuperWord ^
|
||||
-XX:NewRatio=3 ^
|
||||
set GC_TUNE=-XX:NewRatio=3 ^
|
||||
-XX:SurvivorRatio=4 ^
|
||||
-XX:TargetSurvivorRatio=90 ^
|
||||
-XX:MaxTenuringThreshold=8 ^
|
||||
|
@ -38,14 +37,11 @@ set GC_TUNE=-XX:-UseSuperWord ^
|
|||
-XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 ^
|
||||
-XX:+CMSScavengeBeforeRemark ^
|
||||
-XX:PretenureSizeThreshold=64m ^
|
||||
-XX:CMSFullGCsBeforeCompaction=1 ^
|
||||
-XX:+UseCMSInitiatingOccupancyOnly ^
|
||||
-XX:CMSInitiatingOccupancyFraction=50 ^
|
||||
-XX:CMSTriggerPermRatio=80 ^
|
||||
-XX:CMSMaxAbortablePrecleanTime=6000 ^
|
||||
-XX:+CMSParallelRemarkEnabled ^
|
||||
-XX:+ParallelRefProcEnabled ^
|
||||
-XX:+AggressiveOpts
|
||||
-XX:+ParallelRefProcEnabled
|
||||
|
||||
REM Set the ZooKeeper connection string if using an external ZooKeeper ensemble
|
||||
REM e.g. host1:2181,host2:2181/chroot
|
||||
|
|
Loading…
Reference in New Issue