# Understanding Xms Xmx options

**URL:** <https://discuss.elastic.co/t/understanding-xms-xmx-options/4977>\
**Category:** Elasticsearch\
**Created:** [July 27, 2011, 3:56pm UTC](https://discuss.elastic.co/t/understanding-xms-xmx-options/4977 "2011-07-27T15:56:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fucema](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fucema/32/3160_2.png) [@fucema](https://discuss.elastic.co/u/fucema)\
**Post date:** [July 27, 2011, 3:56pm UTC](https://discuss.elastic.co/t/understanding-xms-xmx-options/4977/1 "2011-07-27T15:56:48Z")

</div>

I'm trying to better understand the memory options for Elastic Search. I was  
pretty confident until I looked at the process details recently.

I start a node using this command: bin/elasticsearch -f -Xms5g -Xmx5g

Here is the resulting process details:

elastic 32361 10.3 34.3 5696452 5602468 pts/2 SLl+ 10:59 0:04  
/usr/bin/java -Xms256m -Xmx1g -Xss128k -XX:+UseParNewGC  
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8  
-XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75  
-XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError  
-Delasticsearch -Des.path.home=/usr/local/elastic/elasticsearch  
-Des-foreground=yes -cp  
:/usr/local/elastic/elasticsearch/lib/elasticsearch-0.17.2.jar:/usr/local/elastic/elasticsearch/lib/_:/usr/local/elastic/elasticsearch/lib/sigar/_  
-Xms5g -Xmx5g org.elasticsearch.bootstrap.ElasticSearch

Is the Xms/Xmx setting defining the memory space that is allocated outside  
of the jvm heap? The java executable looks like its set to -Xms256m -Xmx1g.  
It looks like my command line options do not affect the java memory  
parameters.

I've also tried exporting ES\_MIN\_MEM and ES\_MAX\_MEM but I don't see any  
differences in the process details.

---

<div class="post-metadata">

**Author:** ![fucema](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fucema/32/3160_2.png) [@fucema](https://discuss.elastic.co/u/fucema)\
**Post date:** [July 27, 2011, 4:04pm UTC](https://discuss.elastic.co/t/understanding-xms-xmx-options/4977/2 "2011-07-27T16:04:27Z")

</div>

Oops I stand corrected on the last part: when I export ES\_MIN/MAX\_MEM  
settings and start up elastic search, the java memory settings reflect the  
memory settings I defined in the environment variables.

So the problem stands with the command line memory settings.

It gets a little more confusing when I set both the environment variables  
ES\_MIN\_MEM and ES\_MAX\_MEM and also specify memory settings from the command  
line.

export ES\_MIN\_MEM=2g  
export ES\_MAX\_MEM=2g

bin/elasticsearch -f -Xms3g -Xmx3g

What is going on with the memory settings here?

Here are the process details:

elastic 5131 30.5 21.2 3557832 3461188 pts/3 SLl+ 12:01 0:02  
/usr/bin/java -Xms2g -Xmx2g -Xss128k -XX:+UseParNewGC  
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8  
-XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75  
-XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError  
-Delasticsearch -Des.path.home=/usr/local/elastic/elasticsearch  
-Des-foreground=yes -cp  
:/usr/local/elastic/elasticsearch/lib/elasticsearch-0.17.2.jar:/usr/local/elastic/elasticsearch/lib/_:/usr/local/elastic/elasticsearch/lib/sigar/_  
-Xms3g -Xmx3g org.elasticsearch.bootstrap.ElasticSearch

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [July 27, 2011, 5:04pm UTC](https://discuss.elastic.co/t/understanding-xms-xmx-options/4977/3 "2011-07-27T17:04:47Z")

</div>

It is being passed, check at the end of the command. The last memory  
settings used are the ones that are applied, and the script makes use of  
that fact. You can easily see the memory settings elasticsearch was started  
with using the nodes info API.

On Wed, Jul 27, 2011 at 7:04 PM, S Lee [fucema@gmail.com](mailto:fucema@gmail.com) wrote:

> Oops I stand corrected on the last part: when I export ES\_MIN/MAX\_MEM  
> settings and start up Elasticsearch, the java memory settings reflect the  
> memory settings I defined in the environment variables.
> 
> So the problem stands with the command line memory settings.
> 
> It gets a little more confusing when I set both the environment variables  
> ES\_MIN\_MEM and ES\_MAX\_MEM and also specify memory settings from the command  
> line.
> 
> export ES\_MIN\_MEM=2g  
> export ES\_MAX\_MEM=2g
> 
> bin/elasticsearch -f -Xms3g -Xmx3g
> 
> What is going on with the memory settings here?
> 
> Here are the process details:
> 
> elastic 5131 30.5 21.2 3557832 3461188 pts/3 SLl+ 12:01 0:02  
> /usr/bin/java -Xms2g -Xmx2g -Xss128k -XX:+UseParNewGC  
> -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8  
> -XX:MaxTenuringThreshold=1 -XX:CMSInitiatingOccupancyFraction=75  
> -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError  
> -Delasticsearch -Des.path.home=/usr/local/elastic/elasticsearch  
> -Des-foreground=yes -cp  
> :/usr/local/elastic/elasticsearch/lib/elasticsearch-0.17.2.jar:/usr/local/elastic/elasticsearch/lib/_:/usr/local/elastic/elasticsearch/lib/sigar/_  
> -Xms3g -Xmx3g org.elasticsearch.bootstrap.Elasticsearch

---

<div class="post-metadata">

**Author:** ![fucema](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fucema/32/3160_2.png) [@fucema](https://discuss.elastic.co/u/fucema)\
**Post date:** [July 27, 2011, 5:08pm UTC](https://discuss.elastic.co/t/understanding-xms-xmx-options/4977/4 "2011-07-27T17:08:11Z")

</div>

Ok, it is a little confusing because the java binary has 2g memory settings  
but the 3g settings are also listed at the end.

Starts with:  
/usr/bin/java -Xms2g -Xmx2g -Xss128k ...

Ends with:  
... -Xms3g -Xmx3g org.elasticsearch.bootstrap.ElasticSearch

I'll take the node api status page as gospel.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:59am UTC](https://discuss.elastic.co/t/understanding-xms-xmx-options/4977/5 "2017-07-06T03:59:01Z")

</div>


