# Elastic Search heap alert

**URL:** https://discuss.elastic.co/t/elastic-search-heap-alert/155479
**Category:** Elasticsearch
**Created:** [November 6, 2018, 5:49am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479 "2018-11-06T05:49:05Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [November 6, 2018, 5:49am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/1 "2018-11-06T05:49:06Z")

</div>

Hi there,

I don't have much knowledge of elastic search memory management but currently, I am having 445 total indexes and my data size is 6.8GB.and having a 4.6GB heap size. I am using an elastic cloud to store my data. but I am getting following alerts from the elastic cloud :

`Elastic cloud cluster Heap Memory usage is more than 70%.`

How memoery management works in elastic search?  
What is the meaning of this alert?  
How I can solve the heap issue?

---

<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: [November 6, 2018, 6:17am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/2 "2018-11-06T06:17:29Z")

</div>

How many shards do you have? Because you probably have too many shards per node.

May I suggest you look at the following resources about sizing:

[https://www.elastic.co/elasticon/conf/2016/sf/quantitative-cluster-sizing](https://www.elastic.co/elasticon/conf/2016/sf/quantitative-cluster-sizing)

> **[How many shards should I have in my Elasticsearch cluster?
	  	 | Elastic](https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster)**
>
> Elasticsearch is a very versatile platform, that supports a variety of use cases, and provides great flexibility around data organisation and replication strategies. This flexibility can however somet...

> **[NetSecureDay: Managing your Black Friday Logs](https://speakerdeck.com/elastic/netsecureday-managing-your-black-friday-logs)**
>
> Surveiller une application complexe n’est pas une tâche aisée, mais avec les bons outils, ce n’est pas si sorcier. Néanmoins, des périodes fortes telles que les opérations de type « Black Friday » (Vendredi noir) ou période de Noël peuvent pousser...

And [https://www.elastic.co/webinars/using-rally-to-get-your-elasticsearch-cluster-size-right](https://www.elastic.co/webinars/using-rally-to-get-your-elasticsearch-cluster-size-right)

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [November 6, 2018, 6:30am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/3 "2018-11-06T06:30:36Z")

</div>

I have 562 primary and replica shards. and having 3 nodes.

---

<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: [November 6, 2018, 7:23am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/4 "2018-11-06T07:23:09Z")

</div>

562 shards for 6.8GB of data is a way too much where probably one single shard would be able to hold all your dataset.

Each shard consumes resources. That's why you should reduce that number drastically IMO.

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [November 6, 2018, 9:13am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/5 "2018-11-06T09:13:39Z")

</div>

I have added mapping for my index which includes : number\_of\_shards is 2 and number\_of\_replicas is 1 per index.so how I reduce the number of shards if I am having more than 100 index?

---

<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: [November 6, 2018, 9:43am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/6 "2018-11-06T09:43:50Z")

</div>

Why do you have so many indices?  
Why are you setting number of shards = 2 ?

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [November 6, 2018, 10:32am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/7 "2018-11-06T10:32:13Z")

</div>

I am having document of various space. I have created index of each space. so I can added related document in to it. It helps me for query.my documents and index count changes frequently. for that I have so many indices. for shards I don't have much idea.

So how I reduce the number of shards of my all indices also can it solves my heap alert issue?

---

<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: [November 6, 2018, 1:24pm UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/8 "2018-11-06T13:24:33Z")

</div>

> So how I reduce the number of shards of my all indices also can it solves my heap alert issue?

Depending on your version, you can look at the Shrink API. [Shrink Index | Elasticsearch Guide [6.4] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/6.4/indices-shrink-index.html)

> I am having document of various space. I have created index of each space.

Not sure what a "space" means. If it's only an attribute then everything can go to the same index which you can filter by space when you are querying it.

> also can it solves my heap alert issue?

I don't know. May be. You can also increase the heap size if you don't want to change your architecture.

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [November 19, 2018, 8:55am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/9 "2018-11-19T08:55:10Z")

</div>

Hi,

I have reduced the number of shards. Currently, I have 5 shards with 1 index and 3 nodes. My data size is 11.2 GB. and I am not doing any CRUD operation on elasticsearch(my instance is idle) then also my JVM heap size is increasing.

Can you please let me know why my JVM heap size is changing continuously?

---

<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: [November 19, 2018, 10:07am UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/10 "2018-11-19T10:07:26Z")

</div>

Do you have elasticsearch monitoring feature on?  
Can you share the memory chart?

---

<div class="post-metadata">

### Author: ![surajdalvi](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@surajdalvi](https://discuss.elastic.co/u/surajdalvi)
#### Post date: [November 19, 2018, 12:00pm UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/11 "2018-11-19T12:00:48Z")

</div>

Here is the my Elasticsearch performance graph:

 ![Screenshot%20from%202018-11-19%2017-26-38](https://us1.discourse-cdn.com/elastic/original/3X/7/c/7c1223107f742cc52bd1903711910d740605d2a9.png) ![Screenshot%20from%202018-11-19%2017-26-48](https://us1.discourse-cdn.com/elastic/original/3X/8/7/87c251fa65d63f3339fbe796748caa5d894f06bc.png)

is this fine or you want more details. Please let me know.

---

<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: [November 19, 2018, 12:09pm UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/12 "2018-11-19T12:09:14Z")

</div>

That kind of saw-tooth pattern is perfectly normal and healthy. Garbage collection is triggered when usage goes above 75%, and then drops.

---

<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: [November 19, 2018, 12:19pm UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/13 "2018-11-19T12:19:11Z")

</div>

That's right. I wonder though why he is receiving alerts like

> Elastic cloud cluster Heap Memory usage is more than 70%.

May be this is not happening anymore @surajdalvi ?

---

<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: [December 17, 2018, 12:19pm UTC](https://discuss.elastic.co/t/elastic-search-heap-alert/155479/14 "2018-12-17T12:19:12Z")

</div>

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