-
Notifications
You must be signed in to change notification settings - Fork 240
Xms and Xmx specified in ES_JAVA_OPTS variable are not taken into account, overloaded by jvm.options definition #22
Comments
Thank you for your interest in the docker image!
Heap size reported is 494.9MB, see logs below:
This can also be checked with a curl request:
As per the docs it is possible to define the heap size via the ES_JAVA_OPTS variable. |
Thanks a lot Dimitrios for your quick reply ! I tried to reproduce in a different environment and it works but still I am not convinced by this configuration. I agree that the docs you mentioned precised you can define the heap size via the ES_JAVA_OPTS but it also precises that it should be done after having commented out the Xms and Xmx settings in the jvm.options file : Actually, I am really not comfortable by having Xms and Xmx defined twice in the same process: $ docker exec -ti master-1 ps -aef | grep elastic
1 elastics 0:17 /usr/lib/jvm/java-1.8-openjdk/bin/java -Xms2g -Xmx2g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Xms512m -Xmx512m -Des.path.home=/usr/share/elasticsearch -cp /usr/share/elasticsearch/lib/elasticsearch-5.1.1.jar:/usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -Ecluster.name=ISSUE22 -Ediscovery.zen.ping.unicast.hosts=elasticsearch-master-2 -Enode.data=false -Enode.master=true -Enode.name=master-1 -Ediscovery.zen.minimum_master_nodes=2 -Ebootstrap.memory_lock=true -Expack.security.enabled=false -Enode.ingest=false
80 elastics 0:00 ps -aef I am not an expert in JVM configuration but I think it's quite hazardous to predict the behavior even in a docker image. That's my feeling and I will probably create a new image extending the elastic image with a proper jvm.options file. Thanks again for your support. |
@dchambon Doing a customized image with your own jvm.options is definitely a good approrach and there is an example here. Alternatively, if you can provision the needed The double -Xmx -Xms definitions are due to how the startup elasticsearch script works; the params defined in ES_JAVA_OPTS get appended after the ones in jvm.options. Latest openjdk versions (including musl java used in the Alpine image) honor the right most one, so that's why it works:
However, I do agree that this is not a good practice. I will look into it, possibly addressing it in the documentation for starters. |
This is correct. It it recommend but not necessary to comment out the heap settings in the |
I was setting heap size to 512m and was getting a 1g memory usage and was going to reopen this ticket. Here is
Same command when Xmx and Xms is 1g:
I think the confusing part is this line in the logs:
There is |
Relates #43 ; when in doubt, it's best to query the Elasticsearch API about the heap size as shown in this comment: #43 (comment) |
I can't make it work with es:latest, I set it at the composer but checking /etc/elasticsearch/jvm.options it's still at 2g, same for top at docker host, jvm is using 2g not 6g as I set it. |
It would be proper 12-factor to be able to provide all settings as vars. Changing the GC won't work this way as you get "multiple gc" settings. |
docker info
output:[rancher@vct2-rancher-host-1 ~]$ docker info
Containers: 20
Running: 19
Paused: 0
Stopped: 1
Images: 19
Server Version: 1.12.3
Storage Driver: overlay
Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: null bridge overlay host
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.24-rancher
Operating System: RancherOS v0.7.1
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.798 GiB
Name: vct2-rancher-host-1
ID: YMVO:OVCD:A3G4:4ZNI:A2NY:NGIN:IGRF:OTQ6:37DU:ESH7:WZQG:DL6J
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
devserver2.corp.skysoft-atm.com:5000
127.0.0.0/8
docker-compose
version: 1.2.0NAME="RancherOS"
VERSION=v0.7.1
Bug description
I am using the following docker-compose.yml file to instanciate one Elasticsearch node:
My expectation is to have a Xms and Xmx with a value of 512m (overloading. However, it seems that the elasticsearch node is started with the default value defined in the jvm.options file. The container shows 2 different Xms and Xmx values:
Indeed, the bin/es-docker entrypoint only appends the Xmx and Xms in the ES_JAVA_OPTS variable.
Feature Description
The text was updated successfully, but these errors were encountered: