Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checking Elasticsearch Heap Size

How can I check the heap size that is assigned to Elasticsearch engine, is there a way to check it using URL API ? And can I use NEST to check it?

Thanks

like image 539
Hasan Avatar asked Aug 19 '15 15:08

Hasan


People also ask

How do I check my Elasticsearch heap size?

Heap size checkedit If you enable bootstrap. memory_lock , the JVM locks the initial heap size on startup. If the initial heap size is not equal to the maximum heap size, some JVM heap may not be locked after a resize. To avoid these issues, start the JVM with an initial heap size equal to the maximum heap size.

What is heap size in Elasticsearch?

The heap size is the amount of RAM allocated to the Java Virtual Machine of an Elasticsearch node. As a general rule, you should set -Xms and -Xmx to the SAME value, which should be 50% of your total available RAM subject to a maximum of (approximately) 31GB.

How do I check Elasticsearch memory usage?

You can avoid memory usage issues in Elasticsearch by running the Elasticsearch Health Check-Up. It will help check for many configuration errors that are related to memory usage in your cluster and offer overall improvements and suggestions to your setup.

How do you determine heap size?

It is recommended to increase the Java heap space only up to one-half of the total RAM available on the server. Increasing the Java heap space beyond that value can cause performance problems. For example, if your server has 16 GB of RAM available, then the maximum heap space you should use is 8 GB.


1 Answers

In a clustered environment, heap settings can be queried as :

curl -sS  "localhost:9200/_cat/nodes?h=heap*&v"

Eg:

curl -sS  "localhost:9200/_cat/nodes?h=heap*&v"
heap.current heap.percent heap.max
     321.1mb           32  989.8mb
     424.1mb           42  989.8mb
     280.3mb           28  989.8mb

This can also be checked from the ps results, though it will only shed light on the min-max values.

~#ps aux | grep --color=auto -i Xms
elastic  6020  0.0  0.0  12788   936 pts/4    S+   04:24   0:00 grep --color=auto -i Xms elastic+  7218
0.6  9.5 5001220 1565112 ?     Ssl  Jun24   5:14 /usr/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch.WoiU4NhH -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/elasticsearch -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -Xloggc:/var/log/elasticsearch/gc.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=32 -XX:GCLogFileSize=64m -Xms1g -Xmx1g -Des.path.home=/usr/share/elasticsearch -Des.path.conf=/etc/elasticsearch -Des.distribution.flavor=default -Des.distribution.type=deb -cp /usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch -p /var/run/elasticsearch/elasticsearch.pid --quiet

where -Xms is the minheap and -Xmx is maxheap configured.

like image 72
anrajme Avatar answered Nov 05 '22 23:11

anrajme