From c09877c2bde915cbf135927b13325203159d9338 Mon Sep 17 00:00:00 2001 From: kimchy Date: Sat, 1 May 2010 15:55:49 +0300 Subject: [PATCH] Script / Service: Add ES_MIN_MEM and ES_MAX_MEM, closes #156 --- bin/elasticsearch.in.sh | 11 +++++++++-- bin/service/elasticsearch.conf | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bin/elasticsearch.in.sh b/bin/elasticsearch.in.sh index 972e8a500d4..314b99649e1 100644 --- a/bin/elasticsearch.in.sh +++ b/bin/elasticsearch.in.sh @@ -1,9 +1,16 @@ CLASSPATH=$CLASSPATH:$ES_HOME/lib/* +if [ "x$ES_MIN_MEM" = "x" ]; then + ES_MIN_MEM=256 +fi +if [ "x$ES_MAX_MEM" = "x" ]; then + ES_MAX_MEM=1024 +fi + # Arguments to pass to the JVM JAVA_OPTS=" \ - -Xms128M \ - -Xmx1G \ + -Xms${ES_MIN_MEM}m \ + -Xmx${ES_MAX_MEM}m \ -Djline.enabled=true \ -XX:+AggressiveOpts \ -XX:+UseParNewGC \ diff --git a/bin/service/elasticsearch.conf b/bin/service/elasticsearch.conf index 19b9b7723ac..5fba72d1ef4 100644 --- a/bin/service/elasticsearch.conf +++ b/bin/service/elasticsearch.conf @@ -1,4 +1,6 @@ set.default.ES_HOME= +set.default.ES_MIN_MEM=256 +set.default.ES_MAX_MEM=1024 #******************************************************************** # Wrapper Timeout Properties @@ -46,10 +48,10 @@ wrapper.java.additional.8=-XX:+CMSParallelRemarkEnabled wrapper.java.additional.9=-XX:+HeapDumpOnOutOfMemoryError # Initial Java Heap Size (in MB) -wrapper.java.initmemory=128 +wrapper.java.initmemory=%ES_MIN_MEM% # Maximum Java Heap Size (in MB) -wrapper.java.maxmemory=1024 +wrapper.java.maxmemory=%ES_MAX_MEM% # Application parameters. Add parameters as needed starting from 1 wrapper.app.parameter.1=org.elasticsearch.bootstrap.Bootstrap