Add default CLI JVM options (#44545)

This commit adds some default CLI JVM options to control the heap size
and the garbage collector used for the CLI tools. We do this because
otherwise the JVM will default to large initial and max heap sizes based
on the RAM visible to the JVM (which could be all the physical RAM on
the machine if not run in a container-aware JVM). This commit therefore
sets the initial heap size to 4m, the max heap size to 64m, the garbage
collector to the serial collector, and leaves this user-configurable by
honoring ES_JAVA_OPTS last.
This commit is contained in:
Jason Tedor 2019-07-19 17:28:23 -07:00
parent 7c84636029
commit 1f7fc1b497
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
2 changed files with 4 additions and 0 deletions

View File

@ -16,6 +16,10 @@ do
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/$additional_classpath_directory/*"
done
# use a small heap size for the CLI tools, and thus the serial collector to
# avoid stealing many CPU cycles; a user can override by setting ES_JAVA_OPTS
ES_JAVA_OPTS="-Xms4m -Xmx64m -XX:+UseSerialGC ${ES_JAVA_OPTS}"
exec \
"$JAVA" \
$ES_JAVA_OPTS \