# Automatic heap sizing

**URL:** <https://discuss.elastic.co/t/automatic-heap-sizing/293386>\
**Category:** Elasticsearch\
**Created:** [January 3, 2022, 9:20pm UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386 "2022-01-03T21:20:17Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [January 3, 2022, 9:20pm UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/1 "2022-01-03T21:20:17Z")

</div>

I'm testing the automatic heap size feature in 7.16.2. In a 12G VM I was specifying a 4G heap, I removed that setting, restarted Elasticsearch and it used 1G for heap. That seams small to me.

Does it grow the heap if it needs to or is this set at startup?

Does this seem like an appropriate heap size?

Thanks

I saw a similar post, but it went unanswered. [JVM automatic heap sizing set too low (version 7.14.1)](https://discuss.elastic.co/t/jvm-automatic-heap-sizing-set-too-low-version-7-14-1/285447)

---

<div class="post-metadata">

**Author:** ![Agraphie\_holidu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agraphie_holidu/32/79243_2.png) [@Agraphie\_holidu](https://discuss.elastic.co/u/Agraphie_holidu)\
**Post date:** [January 17, 2022, 5:16pm UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/2 "2022-01-17T17:16:34Z")

</div>

I'm observing the same issue. We are running Elasticsearch in docker with the default JVM settings.  
Any help would be appreciated!

Best regards

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [January 19, 2022, 4:32am UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/3 "2022-01-19T04:32:25Z")

</div>

Bump so it won't close.

---

<div class="post-metadata">

**Author:** ![baddack](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/baddack/32/100535_2.png) [@baddack](https://discuss.elastic.co/u/baddack)\
**Post date:** [January 19, 2022, 11:27am UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/4 "2022-01-19T11:27:47Z")

</div>

Hi !

I am not a professionnal about Elastic Stack but from my experience 1G seems a bit small to me too.

Every time I set de maximum heap possible (50% of my RAM without exceeding 31GB) and personally I didn't use automatic / default configuration. However, it depend on your node needs, I think the role of the node is quite important to know how configure the size heap.

Do you ave any issues with 1G of heap ? What is the role of your node ?

I let you with the following link that may help you.

[Set the JVM Heap Size](https://www.elastic.co/guide/en/elasticsearch/reference/current/advanced-configuration.html#set-jvm-heap-size)

I make an assumption after reading that : Maybe a dedicated Master node need a smaller heap size than a data node.

I hope this can help you.

Sincerly.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [January 19, 2022, 12:14pm UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/5 "2022-01-19T12:14:02Z")

</div>

What JVM version are you using?

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [January 19, 2022, 8:32pm UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/6 "2022-01-19T20:32:03Z")

</div>

Doesn't Elastic ship the JVM now? How do I tell?

Does this mean anything?  
/usr/share/Elasticsearch/jdk/bin/java --version  
openjdk 17.0.1 2021-10-19  
OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)  
OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [January 19, 2022, 9:52pm UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/7 "2022-01-19T21:52:47Z")

</div>

That sounds right but I'd check that this is the JDK you're actually using (it should be in `GET _nodes` or `GET _nodes/stats`, I forget which).

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [January 20, 2022, 2:21am UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/8 "2022-01-20T02:21:40Z")

</div>

GET\_nodes shows JVM version 17.0.1 also.

Roles are

```auto
"roles" : [
        "data",
        "ingest",
        "master",
        "remote_cluster_client"
}

```

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [January 28, 2022, 1:14am UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/9 "2022-01-28T01:14:25Z")

</div>

Stayin alive....

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [January 28, 2022, 10:03am UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/10 "2022-01-28T10:03:46Z")

</div>

Sorry Len I don't have any other ideas apart from the question about the JVM version. It could be a bug, and IMO it's also a bug that there seems to be no way to trace how the heap is being calculated. I suggest opening a Github issue on the subject.

---

<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:** [February 25, 2022, 10:04am UTC](https://discuss.elastic.co/t/automatic-heap-sizing/293386/11 "2022-02-25T10:04:36Z")

</div>

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