# Is changing the jvm heap size a problem?

**URL:** https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172
**Category:** Elasticsearch
**Created:** [September 14, 2021, 9:58am UTC](https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172 "2021-09-14T09:58:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![RusseL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russel/32/77328_2.png) [@RusseL](https://discuss.elastic.co/u/RusseL)
#### Post date: [September 14, 2021, 9:58am UTC](https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172/1 "2021-09-14T09:58:35Z")

</div>

Hello, there are a total of 16 nodes in the cluster, including 13 data nodes and 3 master nodes.

Master nodes have 64 gb ram. But jvm heap is set to 16gb.

Data nodes have 64 GB ram. But jvm heap is set to 30gb.

Does the jvm heap value of all servers need to be 32 gb regardless of master node or data node? Also would it be a problem if I set the jvm heap to 32gb?

I'm getting an outofmemory error when transferring data with Logstash. Could this have something to do with the situation?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [September 14, 2021, 10:24am UTC](https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172/2 "2021-09-14T10:24:45Z")

</div>

Java heap should be no larger than around 30 GB so that you benefit from compressed pointers. Increasing the heap to 32 GB would therefore be a mistake. Can you show us the full output of the cluster stats API?

---

<div class="post-metadata">

### Author: ![RusseL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/russel/32/77328_2.png) [@RusseL](https://discuss.elastic.co/u/RusseL)
#### Post date: [September 14, 2021, 11:25am UTC](https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172/3 "2021-09-14T11:25:03Z")

</div>

[Cluster/\_stats API outputs](https://github.com/Resul-Hasturk/Elasticsearch/blob/main/_cluster/stats2)

If you can not see the outputs just tell me

---

<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: [September 14, 2021, 9:50pm UTC](https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172/4 "2021-09-14T21:50:58Z")

</div>

Other than Christian's comments, you can usually set **master only** nodes to use less heap, 8 gig should be heaps.

---

<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: [October 12, 2021, 9:51pm UTC](https://discuss.elastic.co/t/is-changing-the-jvm-heap-size-a-problem/284172/5 "2021-10-12T21:51:19Z")

</div>

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