peasead / elastic-container

Stand up a simple Elastic container with Kibana, Fleet, and the Detection Engine
Apache License 2.0
395 stars 71 forks source link

How to increase JVM heap size? #45

Open desertSniper87 opened 5 months ago

desertSniper87 commented 5 months ago

How to increase the JVM heap size from 512m to 1G?

The official docs say this to pass as environment variable -Xms1g -Xmx1g: https://www.elastic.co/guide/en/elastic-stack-get-started/current/get-started-stack-docker.html#docker-enroll-nodes

desertSniper87 commented 5 months ago

We can change the heap size by editing docker-compose.yml and passing ES_JAVA_OPTS environment variable to elasticsearch container.

  elasticsearch:
   ...
    environment:
+     - ES_JAVA_OPTS=-Xmx1g -Xms1g

Added a pull request to change the readme https://github.com/peasead/elastic-container/pull/46#issue-2378867303

peasead commented 5 months ago

I think those are legacy docs. If you look you can see it's for version 8.2.

Looking here at 8.14 (the current version), it says

By default, Elasticsearch automatically sets the JVM heap size based on a node’s roles and total memory. Using the default sizing is recommended for most production environments.

Do you see something that recommends adjusting the heap size in 8.14?

peasead commented 5 months ago

Also, is this different than what's in the docker-compose.yml file?

https://github.com/peasead/elastic-container/blob/72e2879d63bf6525c62932dfda88a21dbf4f34a5/docker-compose.yml#L97-L101