Created
January 6, 2013 07:11
-
-
Save anonymous/4465781 to your computer and use it in GitHub Desktop.
/etc/default/elasticsearch on Debian
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Index settings: | |
# index.store.compress.tv: true | |
# index.store.compress.stored: true | |
# Based on Cassandra Java configuration: | |
# https://svn.apache.org/repos/asf/cassandra/trunk/conf/cassandra-env.sh | |
calculate_heap_sizes() | |
{ | |
system_memory_in_mb=`free -m | awk '/Mem:/ {print $2}'` | |
system_cpu_cores=`egrep -c 'processor([[:space:]]+):.*' /proc/cpuinfo` | |
# set max heap size based on the following | |
# max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB)) | |
# calculate 1/2 ram and cap to 1024MB | |
# calculate 1/4 ram and cap to 8192MB | |
# pick the max | |
half_system_memory_in_mb=`expr $system_memory_in_mb / 2` | |
quarter_system_memory_in_mb=`expr $half_system_memory_in_mb / 2` | |
if [ "$half_system_memory_in_mb" -gt "1024" ] | |
then | |
half_system_memory_in_mb="1024" | |
fi | |
if [ "$quarter_system_memory_in_mb" -gt "8192" ] | |
then | |
quarter_system_memory_in_mb="8192" | |
fi | |
if [ "$half_system_memory_in_mb" -gt "$quarter_system_memory_in_mb" ] | |
then | |
max_heap_size_in_mb="$half_system_memory_in_mb" | |
else | |
max_heap_size_in_mb="$quarter_system_memory_in_mb" | |
fi | |
ES_HEAP_SIZE="${max_heap_size_in_mb}M" | |
# Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 * heap size) | |
max_sensible_yg_per_core_in_mb="100" | |
max_sensible_yg_in_mb=`expr $max_sensible_yg_per_core_in_mb "*" $system_cpu_cores` | |
desired_yg_in_mb=`expr $max_heap_size_in_mb / 4` | |
if [ "$desired_yg_in_mb" -gt "$max_sensible_yg_in_mb" ] | |
then | |
ES_HEAP_NEWSIZE="${max_sensible_yg_in_mb}M" | |
else | |
ES_HEAP_NEWSIZE="${desired_yg_in_mb}M" | |
fi | |
} | |
calculate_heap_sizes | |
# Additional Java OPTS | |
ES_JAVA_OPTS="-XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment