Unable to change JDK Heap Size


(Nathan) #1

My ES keeps crashing due to Java running out of memory in regards to the Java heap.

It was set with the default, which I believe was 1 GB. I checked the setting in /etc/sysconfig/elasticsearch to be 8 GB. I’ve restarted ES as well as restarted the VM. But when I check on the status of the Graylog service it still shows that it started with 1 GB:

elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2017-03-07 14:12:45 EST; 23min ago
Docs: http://www.elastic.co
Process: 866 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 870 (java)
CGroup: /system.slice/elasticsearch.service
└─870 /bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX…

Isn’t the -Xmx1g flag indicating that it has a max heap size of 1 GB? Or am I not understanding that correctly?


(Philipp Ruland) #2

Hey @nathanmace,

you are correct, the -Xmx flag defines the maximum heap size.

What setting did you use? ES_HEAP_SIZE or ES_JAVA_OPTS?
Did you check if they conflict? For example having ES_HEAP_SIZE=8GB and ES_JAVA_OPTS=-Xmx1G at the same time. As far as I know ES_HEAP_SIZE is the preferred way but ES_JAVA_OPTS takes precedence over everything else.

Greetings - Phil


(Jan Doberstein) #3

did you check the documentation how to raise the heap? As you want to raise your Elasticsearch Heap you might find the default file location more useful.

And @DerPhlipsi is right, you need to check all other locations that might get in conflict.