SOLR-6705: better handling of JVM version specific options

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1638022 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy Potter 2014-11-11 04:21:44 +00:00
parent 6270a1fc13
commit 83a04af6fb
2 changed files with 20 additions and 19 deletions

View File

@ -988,7 +988,18 @@ function launch_solr() {
SOLR_ADDL_ARGS="$2"
# commented out debugging info
# 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); }'`
if [ "${JAVA_VERSION:0:3}" == "1.7" ]; then
# Specific Java version hacking
GC_TUNE="$GC_TUNE -XX:CMSFullGCsBeforeCompaction=1 -XX:CMSTriggerPermRatio=80"
JAVA_MINOR_VERSION=${JAVA_VERSION:(-2)}
if [[ $JAVA_MINOR_VERSION -ge 40 && $JAVA_MINOR_VERSION -le 51 ]]; then
GC_TUNE="$GC_TUNE -XX:-UseSuperWord"
echo -e "\nWARNING: Java version $JAVA_VERSION has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.\n"
fi
fi
if $verbose ; then
echo -e "\nStarting Solr using the following settings:"
echo -e " SOLR_SERVER_DIR = $SOLR_SERVER_DIR"
@ -1028,7 +1039,9 @@ $SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \
if [ "$SOLR_MODE" == "solrcloud" ]; then
IN_CLOUD_MODE=" in SolrCloud mode"
fi
mkdir -p $SOLR_SERVER_DIR/logs
if [ "$run_in_foreground" == "true" ]; then
echo -e "\nStarting Solr$IN_CLOUD_MODE on port $SOLR_PORT from $SOLR_SERVER_DIR\n"
$JAVA $SOLR_START_OPTS $SOLR_ADDL_ARGS -XX:OnOutOfMemoryError="$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT" -jar start.jar
@ -1174,7 +1187,8 @@ else
echo $CLOUD_REPFACT
USER_INPUT=
read -e -p "Please choose a configuration for the $CLOUD_COLLECTION collection, available options are:\nbasic_configs, data_driven_schema_configs, or sample_techproducts_configs [data_driven_schema_configs] " USER_INPUT
echo "Please choose a configuration for the $CLOUD_COLLECTION collection, available options are:"
read -e -p "basic_configs, data_driven_schema_configs, or sample_techproducts_configs [data_driven_schema_configs] " USER_INPUT
# trim whitespace out of the user input
CLOUD_CONFIG=`echo $USER_INPUT | tr -d ' '`

View File

@ -19,15 +19,14 @@
#SOLR_JAVA_HOME=""
# Increase Java Min/Max Heap as needed to support your indexing / query needs
SOLR_JAVA_MEM="-Xms512m -Xmx512m -XX:MaxPermSize=256m -XX:PermSize=256m"
SOLR_JAVA_MEM="-Xms512m -Xmx512m"
# Enable verbose GC logging
GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \
-XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime"
# These GC settings have shown to work well for a number of common Solr workloads
GC_TUNE="-XX:-UseSuperWord \
-XX:NewRatio=3 \
GC_TUNE="-XX:NewRatio=3 \
-XX:SurvivorRatio=4 \
-XX:TargetSurvivorRatio=90 \
-XX:MaxTenuringThreshold=8 \
@ -36,23 +35,11 @@ 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"
# Mac OSX and Cygwin don't seem to like the UseLargePages flag
thisOs=`uname -s`
# for now, we don't support running this script from cygwin due to problems
# like not having lsof, ps waux, curl, and awkward directory handling
if [[ "$thisOs" != "Darwin" && "${thisOs:0:6}" != "CYGWIN" ]]; then
# UseLargePages flag causes JVM crash on Mac OSX
GC_TUNE="$GC_TUNE -XX:+UseLargePages"
fi
-XX:+ParallelRefProcEnabled"
# Set the ZooKeeper connection string if using an external ZooKeeper ensemble
# e.g. host1:2181,host2:2181/chroot