# Elasticsearch cluster down due to Elasticsearch:java.lang.OutOfMemoryError: Java heap space

**URL:** <https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154>\
**Category:** Elasticsearch\
**Created:** [May 28, 2019, 5:12pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154 "2019-05-28T17:12:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsagwan](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gsagwan](https://discuss.elastic.co/u/gsagwan)\
**Post date:** [May 28, 2019, 5:12pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154/1 "2019-05-28T17:12:08Z")

</div>

We are encountering an issue, wherein multiple nodes in our elasticsearch cluster goes down due to Elasticsearch:java.lang.OutOfMemoryError: Java heap space.  
As a result of this all the shards get unassigned and takes a long time to recover.

Urgent help will be highly appreciated. We have encountered this issue thrice in 5 days.

---

<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:** [May 28, 2019, 5:16pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154/2 "2019-05-28T17:16:07Z")

</div>

If Elasticsearch hits an `OutOfMemoryError` then, by default, it will write a heap dump before exiting. You will need to load this heap dump (e.g. using [MAT](https://www.eclipse.org/mat/)) to work out why it ran out of memory.

Also note that Elasticsearch 7 has much better protection against `OutOfMemoryError`s than earlier versions. It would be wise to upgrade.

---

<div class="post-metadata">

**Author:** ![gsagwan](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gsagwan](https://discuss.elastic.co/u/gsagwan)\
**Post date:** [May 28, 2019, 5:30pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154/3 "2019-05-28T17:30:18Z")

</div>

Hi David,  
Thanks for you reply.

We are looking for some tuning parameters for our cluster. Please suggest. Below are cluster specs.  
26 nodes  
1,488 indices  
11,170 shards  
38,558,392,038 docs  
18.28TB  
Xmx: 31GB  
Xms: 31 GB  
Node configuration: 16c64G.

---

<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:** [May 28, 2019, 5:39pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154/4 "2019-05-28T17:39:00Z")

</div>

There is no way to answer such a vague question, sorry. You will need to perform your own benchmarks and experiments.

---

<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 25, 2019, 5:39pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-down-due-to-elasticsearch-java-lang-outofmemoryerror-java-heap-space/183154/5 "2019-06-25T17:39:09Z")

</div>

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