fix: Revert removal of -Xms JVM option

Logstash has '-Xms1g' set inside 'config/jvm.options', so either -Xms
must be set, or -Xmx must be greater than 1g (which is too high of a
default for docker-elk).

Elastic explicitly recommends setting -Xms and -Xmx to the same value
for Elasticsearch:
  https://www.elastic.co/guide/en/elasticsearch/reference/8.2/advanced-configuration.html#set-jvm-heap-size
This commit is contained in:
Antoine Cotten 2022-05-16 21:29:08 +02:00
parent 239099874a
commit 4319be7cd0
No known key found for this signature in database
GPG Key ID: 94637E68D4A79DD0
3 changed files with 9 additions and 8 deletions

View File

@ -368,11 +368,13 @@ For example, to increase the maximum JVM Heap Size for Logstash:
logstash: logstash:
environment: environment:
LS_JAVA_OPTS: -Xmx1g LS_JAVA_OPTS: -Xms1g -Xmx1g
``` ```
When these options are not set, both Elasticsearch and Logstash start with an upper cap of [1/4 of the total host When these options are not set:
memory][jvm-heap] set on the JVM Heap Size.
* Elasticsearch starts with a JVM Heap Size that is [determined automatically][es-heap].
* Logstash starts with a fixed JVM Heap Size of 1 GB.
### How to enable a remote JMX connection to a service ### How to enable a remote JMX connection to a service
@ -416,6 +418,7 @@ See the following Wiki pages:
[booststap-checks]: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html [booststap-checks]: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
[es-sys-config]: https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html [es-sys-config]: https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html
[es-heap]: https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html#heap-size-settings
[win-filesharing]: https://docs.docker.com/desktop/windows/#file-sharing [win-filesharing]: https://docs.docker.com/desktop/windows/#file-sharing
[mac-filesharing]: https://docs.docker.com/desktop/mac/#file-sharing [mac-filesharing]: https://docs.docker.com/desktop/mac/#file-sharing
@ -436,5 +439,3 @@ See the following Wiki pages:
[ls-docker]: https://www.elastic.co/guide/en/logstash/current/docker-config.html [ls-docker]: https://www.elastic.co/guide/en/logstash/current/docker-config.html
[upgrade]: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html [upgrade]: https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html
[jvm-heap]: https://docs.oracle.com/en/java/javase/18/gctuning/parallel-collector1.html#GUID-74BE3BC9-C7ED-4AF8-A202-793255C864C4

View File

@ -36,7 +36,7 @@ services:
- "9200:9200" - "9200:9200"
- "9300:9300" - "9300:9300"
environment: environment:
ES_JAVA_OPTS: -Xmx512m ES_JAVA_OPTS: -Xms512m -Xmx512m
# Bootstrap password. # Bootstrap password.
# Used to initialize the keystore during the initial startup of # Used to initialize the keystore during the initial startup of
# Elasticsearch. Ignored on subsequent runs. # Elasticsearch. Ignored on subsequent runs.
@ -61,7 +61,7 @@ services:
- "5000:5000/udp" - "5000:5000/udp"
- "9600:9600" - "9600:9600"
environment: environment:
LS_JAVA_OPTS: -Xmx256m LS_JAVA_OPTS: -Xms256m -Xmx256m
LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-} LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
networks: networks:
- elk - elk

View File

@ -9,7 +9,7 @@ services:
volumes: volumes:
- ./extensions/enterprise-search/config/enterprise-search.yml:/usr/share/enterprise-search/config/enterprise-search.yml:ro,Z - ./extensions/enterprise-search/config/enterprise-search.yml:/usr/share/enterprise-search/config/enterprise-search.yml:ro,Z
environment: environment:
JAVA_OPTS: -Xmx2g JAVA_OPTS: -Xms2g -Xmx2g
ENT_SEARCH_DEFAULT_PASSWORD: 'changeme' ENT_SEARCH_DEFAULT_PASSWORD: 'changeme'
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-} ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
ports: ports: