From 1f7fc1b497736fdb3a49ad420c63700f9c3fd451 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 19 Jul 2019 17:28:23 -0700 Subject: [PATCH] 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. --- distribution/src/bin/elasticsearch-cli | 4 ++++ distribution/src/bin/elasticsearch-cli.bat | Bin 615 -> 838 bytes 2 files changed, 4 insertions(+) diff --git a/distribution/src/bin/elasticsearch-cli b/distribution/src/bin/elasticsearch-cli index ae0c88b2043..4af827b67ca 100644 --- a/distribution/src/bin/elasticsearch-cli +++ b/distribution/src/bin/elasticsearch-cli @@ -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 \ diff --git a/distribution/src/bin/elasticsearch-cli.bat b/distribution/src/bin/elasticsearch-cli.bat index 405f97ccc8dbf21e91ee0d883897787ecd879531..80b488c66e98cdd32e4f3660b978716be0fb8ebf 100644 GIT binary patch delta 235 zcmY+8&1%9x6om;C7rsGvXXC1MS6nDAB$U!3HV_q8mD|Zx2WB!dcM?oDeI>zn@Kt<` zPO`GA10Uz__HgZ;v*g#aMI{V^STY6&rXxiEFm}!(92n{R9l<#x&!Do1sFIEgdrbz) z8N({HX4h}qsCK%51SX@)JuH