# Will replica shards in single node cluster consume jvm heap memory

**URL:** <https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940>\
**Category:** Elasticsearch\
**Created:** [August 31, 2020, 11:05am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940 "2020-08-31T11:05:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)\
**Post date:** [August 31, 2020, 11:05am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/1 "2020-08-31T11:05:36Z")

</div>

Hi,

I am using single node with 8 GB JVM (half of total 16 GB).  
Total shards = 1951

I know ES will refuse to allocate both the primary shard and a replica shard on the same machine.but is this replica shards consuming heap?

to my understanding 1951 shards is incuding 5 replica shards for each index.  
So is this unassigned shards consuming heap.

---

<div class="post-metadata">

**Author:** ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)\
**Post date:** [August 31, 2020, 11:06am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/2 "2020-08-31T11:06:56Z")

</div>

Kindly clarify.And this ES node is crashing so often.So need to come up with shrink API for shard reduction

---

<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:** [August 31, 2020, 11:09am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/3 "2020-08-31T11:09:55Z")

</div>

Replica shards are not allocated, so do not consume heap. You however [have far too many shards](https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster) so I would recommend you look to reduce this dramatically as it impacts performance and potentially also stability.

---

<div class="post-metadata">

**Author:** ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)\
**Post date:** [August 31, 2020, 11:15am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/4 "2020-08-31T11:15:25Z")

</div>

wow..thank you so much for quick reply.  
Kindly advice whether doing the following will improve performance.  
1 .making 3 node cluster  
2. using shrink API reducing number of shards

Incase of 3 node cluster without shards reduction will there will be overhead on one node ??

---

<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:** [August 31, 2020, 11:21am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/5 "2020-08-31T11:21:02Z")

</div>

How much space does your indices take up on disk? Shrinking the indices will help, but if they are very small it may be better to reindex into e.g. consolidated monthly indices in order to reduce the shard count further. Adding nodes will help but may not be necessary unless you want to improve resiliency and achieve high availability.

---

<div class="post-metadata">

**Author:** ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)\
**Post date:** [September 1, 2020, 7:25am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/6 "2020-09-01T07:25:39Z")

</div>

Using GET /\_cluster/stats in kibana under  
fs{  
total :229 GB  
free : 94 GB  
}  
mem{  
total 16 GBB  
free 1 percent  
}

---

<div class="post-metadata">

**Author:** ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)\
**Post date:** [September 1, 2020, 7:32am UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/7 "2020-09-01T07:32:53Z")

</div>

And to add already daily index have been consolidated to monthly.As max shards/per node can be 20/jvm heap,my jvm heap is 8GB ,thus 8\*20 = 160 shards.but there are 1500+ shards .

```
  "mem" : {
    "heap_max_" : 8 GB }
```

---

<div class="post-metadata">

**Author:** ![divya\_lakshmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divya_lakshmi/32/72393_2.png) [@divya\_lakshmi](https://discuss.elastic.co/u/divya_lakshmi)\
**Post date:** [September 3, 2020, 4:14pm UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/8 "2020-09-03T16:14:31Z")

</div>

any help on this

---

<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 1, 2020, 4:14pm UTC](https://discuss.elastic.co/t/will-replica-shards-in-single-node-cluster-consume-jvm-heap-memory/246940/9 "2020-10-01T16:14:43Z")

</div>

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