2012-06-10 22:27:52 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2011-08-03 14:29:05 -04:00
|
|
|
ES_CLASSPATH=$ES_CLASSPATH:$ES_HOME/lib/*:$ES_HOME/lib/sigar/*
|
2010-02-08 08:30:06 -05:00
|
|
|
|
2010-05-01 08:55:49 -04:00
|
|
|
if [ "x$ES_MIN_MEM" = "x" ]; then
|
2010-06-30 14:51:34 -04:00
|
|
|
ES_MIN_MEM=256m
|
2010-05-01 08:55:49 -04:00
|
|
|
fi
|
|
|
|
if [ "x$ES_MAX_MEM" = "x" ]; then
|
2010-06-30 14:51:34 -04:00
|
|
|
ES_MAX_MEM=1g
|
2010-05-01 08:55:49 -04:00
|
|
|
fi
|
2012-02-06 15:09:32 -05:00
|
|
|
if [ "x$ES_HEAP_SIZE" != "x" ]; then
|
|
|
|
ES_MIN_MEM=$ES_HEAP_SIZE
|
|
|
|
ES_MAX_MEM=$ES_HEAP_SIZE
|
|
|
|
fi
|
2010-05-01 08:55:49 -04:00
|
|
|
|
2010-11-22 20:51:38 -05:00
|
|
|
# min and max heap sizes should be set to the same value to avoid
|
|
|
|
# stop-the-world GC pauses during resize, and so that we can lock the
|
|
|
|
# heap in memory on startup to prevent any of it from being swapped
|
|
|
|
# out.
|
2010-08-13 18:10:36 -04:00
|
|
|
JAVA_OPTS="$JAVA_OPTS -Xms${ES_MIN_MEM}"
|
|
|
|
JAVA_OPTS="$JAVA_OPTS -Xmx${ES_MAX_MEM}"
|
2010-11-22 20:51:38 -05:00
|
|
|
|
2012-02-06 15:09:32 -05:00
|
|
|
# new generation
|
|
|
|
if [ "x$ES_HEAP_NEWSIZE" != "x" ]; then
|
|
|
|
JAVA_OPTS="$JAVA_OPTS -Xmn${ES_HEAP_NEWSIZE}"
|
|
|
|
fi
|
|
|
|
|
2010-11-22 20:51:38 -05:00
|
|
|
# reduce the per-thread stack size
|
2012-04-29 10:16:41 -04:00
|
|
|
JAVA_OPTS="$JAVA_OPTS -Xss256k"
|
2010-08-13 18:10:36 -04:00
|
|
|
|
2011-09-22 17:57:57 -04:00
|
|
|
# Force the JVM to use IPv4 stack
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
|
|
|
|
|
2010-11-06 18:46:46 -04:00
|
|
|
# Enable aggressive optimizations in the JVM
|
2011-01-19 17:13:18 -05:00
|
|
|
# - Disabled by default as it might cause the JVM to crash
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts"
|
2010-08-13 18:10:36 -04:00
|
|
|
|
|
|
|
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
|
|
|
|
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
|
2012-02-06 15:11:22 -05:00
|
|
|
|
2010-10-15 12:26:38 -04:00
|
|
|
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
|
|
|
|
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
|
|
|
|
|
2012-01-26 06:52:43 -05:00
|
|
|
# When running under Java 7
|
|
|
|
#JAVA_OPTS="$JAVA_OPTS -XX:+UseCondCardMark"
|
|
|
|
|
2011-01-07 09:59:50 -05:00
|
|
|
# GC logging options -- uncomment to enable
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -XX:+PrintClassHistogram"
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -XX:+PrintTenuringDistribution"
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
|
|
|
|
# JAVA_OPTS="$JAVA_OPTS -Xloggc:/var/log/elasticsearch/gc.log"
|
|
|
|
|
2010-11-22 20:51:38 -05:00
|
|
|
# Causes the JVM to dump its heap on OutOfMemory.
|
2010-08-13 18:10:36 -04:00
|
|
|
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
|
2010-11-22 20:51:38 -05:00
|
|
|
# The path to the heap dump location, note directory must exists and have enough
|
|
|
|
# space for a full heap dump.
|
|
|
|
#JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof"
|