# Setting Xms and Xmx

**URL:** <https://discuss.elastic.co/t/setting-xms-and-xmx/273875>\
**Category:** Elasticsearch\
**Created:** [May 24, 2021, 11:14pm UTC](https://discuss.elastic.co/t/setting-xms-and-xmx/273875 "2021-05-24T23:14:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkaramol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pkaramol/32/22610_2.png) [@pkaramol](https://discuss.elastic.co/u/pkaramol)\
**Post date:** [May 24, 2021, 11:14pm UTC](https://discuss.elastic.co/t/setting-xms-and-xmx/273875/1 "2021-05-24T23:14:14Z")

</div>

I assume this is a long-debated topic but I was kind of puzzled by [this](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/advanced-configuration.html#advanced-configuration) recommendation:

> Modifying advanced settings is generally not recommended and could negatively impact performance and stability. Using the Elasticsearch-provided defaults is recommended in most circumstances.

Does this mean for example, that, when using pretty large nodes (in the likes of `64G` RAM), it is still recommended to leave the `Xms` / `Xmx` values to their defaults? Doesn't having so low Xm\* values in a context of such a large resident memory limit the potential of the stack?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 24, 2021, 11:26pm UTC](https://discuss.elastic.co/t/setting-xms-and-xmx/273875/2 "2021-05-24T23:26:45Z")

</div>

We do recommend setting those to be the same, and at 50% of the available system memory - [Advanced configuration | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/advanced-configuration.html#set-jvm-heap-size)

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 25, 2021, 8:52am UTC](https://discuss.elastic.co/t/setting-xms-and-xmx/273875/3 "2021-05-25T08:52:52Z")

</div>

Adding to Mark's answer that in the latest version

> Elasticsearch automatically sets the JVM heap size based on a node’s [roles](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html#node-roles) and total memory. Using the default sizing is recommended for most production environments.

(Quote from the docs)

---

<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:** [June 22, 2021, 8:53am UTC](https://discuss.elastic.co/t/setting-xms-and-xmx/273875/4 "2021-06-22T08:53:04Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
