Checking Elasticsearch Heap Size Checking Elasticsearch Heap Size elasticsearch elasticsearch

Checking Elasticsearch Heap Size


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 Xmselastic  6020  0.0  0.0  12788   936 pts/4    S+   04:24   0:00 grep --color=auto -i Xms elastic+  72180.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.


use GET _nodes/stats

Then look at the following in the return /jvm/mem/heap_committed_in_bytes


This is a new account so I couldn't comment on jhilden's answer. His answer is correct but to answer your comment I use Postman which is a chrome app. It's very easy to use and has been ideal for me whilst working with Elasticsearch.

Putting the following in postman and hitting send does the job!

http://localhost:9200/_nodes/stats

review the results and look for the "jvm" block. Here is what is returned when I run it on a default elasticsearch setup:

"jvm": {    "timestamp": 1477474766408,    "uptime_in_millis": 1309586,    "mem": {      **"heap_used_in_bytes": 87134248**,      "heap_used_percent": 8,      "heap_committed_in_bytes": 259522560,      "heap_max_in_bytes": 1038876672,      "non_heap_used_in_bytes": 56166992,      "non_heap_committed_in_bytes": 57348096,