# Confusing memory settings on Ubuntu

**URL:** <https://discuss.elastic.co/t/confusing-memory-settings-on-ubuntu/29065>\
**Category:** Elasticsearch\
**Created:** [September 10, 2015, 8:03pm UTC](https://discuss.elastic.co/t/confusing-memory-settings-on-ubuntu/29065 "2015-09-10T20:03:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florin\_Andrei](https://avatars.discourse-cdn.com/v4/letter/f/c77e96/32.png) [@Florin\_Andrei](https://discuss.elastic.co/u/Florin_Andrei)\
**Post date:** [September 10, 2015, 8:03pm UTC](https://discuss.elastic.co/t/confusing-memory-settings-on-ubuntu/29065/1 "2015-09-10T20:03:19Z")

</div>

When I install ES from a .deb package on Ubuntu, it creates /etc/default/elasticsearch with something like this:

```
ES_HEAP_SIZE=2g
ES_MIN_MEM=512m
ES_MAX_MEM=2g
ES_JAVA_OPTS="-Xmx2048m -Xms512m"

```

All these things are passed as environment variables inside the actual startup script.

Aren't all those settings redundant? Can I just set ES\_HEAP\_SIZE and call it a day?

Or do I have to also set -Xmx and -Xms? And if this is the case, do I need to set -Xmx bigger than heap?

How would you change that list of variables, if any changes are required? I'm not talking about the actual heap size and whatnot, but I'm curious whether it makes sense to maintain that list, and how the various values should be correlated, if at all.

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [September 11, 2015, 12:01am UTC](https://discuss.elastic.co/t/confusing-memory-settings-on-ubuntu/29065/2 "2015-09-11T00:01:47Z")

</div>

Once you define ES\_HEAP\_SIZE the script will set MIN & MAX:

```auto
$ cd /usr/share/elasticsearch/bin
$ grep ES_HEAP_SIZE elasticsearch.in.sh 
if ["x$ES_HEAP_SIZE" != "x"]; then
    ES_MIN_MEM=$ES_HEAP_SIZE
    ES_MAX_MEM=$ES_HEAP_SIZE

```

So yes they are redundant but they are there should you want to set them differently. So you can just set ES\_HEAP\_SIZE and comment out ES\_MIN\_MEM, ES\_MAX\_MEM & ES\_JAVA\_OPTS and to avoid any confusion if they are defined in your /etc/default/elasticsearch.

---

<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 5, 2017, 11:51pm UTC](https://discuss.elastic.co/t/confusing-memory-settings-on-ubuntu/29065/3 "2017-07-05T23:51:02Z")

</div>


