# How to check ES\_HEAP\_SIZE

**URL:** <https://discuss.elastic.co/t/how-to-check-es-heap-size/36613>\
**Category:** Elasticsearch\
**Created:** [December 8, 2015, 9:07am UTC](https://discuss.elastic.co/t/how-to-check-es-heap-size/36613 "2015-12-08T09:07:07Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [December 8, 2015, 3:35pm UTC](https://discuss.elastic.co/t/how-to-check-es-heap-size/36613/6 "2015-12-08T15:35:20Z")

</div>

> [@gpong](#):
>
> I tried to setting ES\_HEAP\_SIZE to 1024m on my linux server. I used this setting \> export ES\_HEAP\_SIZE=1024m. Now how to check if this new setting is work??

Both Elasticsearch and the JVM provides some wonderful introspection tools, so there are many ways to check this.

- Query the endpoint `/_nodes/stats/jvm` and for each node inspect the path `jvm.mem.heap_max_in_bytes`. For example, if I start Elasticsearch with `ES_HEAP_SIZE=4g` listening on localhost and then execute

```auto
curl -sS -XGET localhost:9200/_nodes/stats/jvm | jq '..|.heap_max_in_bytes?|select(type != "null")'

```

I see

```auto
4225236992

```

- Similarly, you can use the cat nodes API by executing

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

```

which would give

```auto
heap.current heap.percent heap.max 
     119.9mb 2 3.9gb 

```

with the same 4g heap.

on the console. If you have multiple nodes running, this will print out one line for each node.

- You can use jps to see the command line flags. For example, if I start Elasticsearch with `ES_HEAP_SIZE=4g` and then execute

```auto
jps -l -m -v

```

then I see

```auto
5858 org.elasticsearch.bootstrap.eElasticsearche start -Xms4g -Xmx4g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/Users/jason/elasticsearch/elasticsearch-2.1.0

```

- Another good tool to know is `jinfo`. For example:

```auto
jinfo -flags 5858

```

gives

```auto
Attaching to process ID 5858, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.66-b17
Non-default VM flags: -XX:CICompilerCount=4 -XX:CMSInitiatingOccupancyFraction=75 -XX:+DisableExplicitGC -XX:+HeapDumpOnOutOfMemoryError -XX:InitialHeapSize=4294967296 -XX:MaxHeapSize=4294967296 -XX:MaxNewSize=697892864 -XX:MaxTenuringThreshold=6 -XX:MinHeapDeltaBytes=196608 -XX:NewSize=697892864 -XX:OldPLABSize=16 -XX:OldSize=3597074432 -XX:+UseCMSInitiatingOccupancyOnly -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseConcMarkSweepGC -XX:+UseFastUnorderedTimeStamps -XX:+UseParNewGC 
Command line: -Xms4g -Xmx4g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/Users/jason/elasticsearch/elasticsearch-2.1.0

```

Note the `-XX:InitialHeapSize=4294967296 -XX:MaxHeapSize=4294967296` in the output.

There are many other ways to check this same information (JVisualVM, Java Mission Control, `jstat`, `jmap`, etc.).

---

_[View the full topic](https://discuss.elastic.co/t/how-to-check-es-heap-size/36613)._
