# If there are any config for garbage collection in Elastic search

**URL:** <https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953>\
**Category:** Elasticsearch\
**Created:** [October 25, 2018, 9:01am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953 "2018-10-25T09:01:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinesh2](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@dinesh2](https://discuss.elastic.co/u/dinesh2)\
**Post date:** [October 25, 2018, 9:01am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/1 "2018-10-25T09:01:23Z")

</div>

Please suggest if there are any config for garbage collection.

Regards,  
Dinesh D

---

<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:** [October 25, 2018, 9:03am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/2 "2018-10-25T09:03:03Z")

</div>

Elasticsearch does its own GC.

---

<div class="post-metadata">

**Author:** ![dinesh2](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@dinesh2](https://discuss.elastic.co/u/dinesh2)\
**Post date:** [October 25, 2018, 9:20am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/3 "2018-10-25T09:20:48Z")

</div>

So we cant ableconfigure it right ?

Regards,  
Dinesh D

---

<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:** [October 25, 2018, 9:26am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/4 "2018-10-25T09:26:28Z")

</div>

Why do you want to do that?

---

<div class="post-metadata">

**Author:** ![dinesh2](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@dinesh2](https://discuss.elastic.co/u/dinesh2)\
**Post date:** [October 25, 2018, 9:34am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/5 "2018-10-25T09:34:35Z")

</div>

My JVM memory goes almost 75%

---

<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:** [October 25, 2018, 9:52am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/6 "2018-10-25T09:52:57Z")

</div>

Then altering the GC settings for Elasticsearch will not solve anything, you just delay the problem and make it worse when it happens.

Is the GC causing big problems?

---

<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:** [October 25, 2018, 9:55am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/7 "2018-10-25T09:55:44Z")

</div>

Heap usage usually gets to 75% before GC is triggered. As long as it goes down after this it is generally a nice and healthy pattern. If you are constantly at or around 75% heap usage you may need to increase your heap size by scaling up or out.

---

<div class="post-metadata">

**Author:** ![dinesh2](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@dinesh2](https://discuss.elastic.co/u/dinesh2)\
**Post date:** [October 25, 2018, 11:35am UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/8 "2018-10-25T11:35:03Z")

</div>

Thanks, I will increase the xmx and xms to 4 GB

---

<div class="post-metadata">

**Author:** ![Admin\_Hack](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Admin\_Hack](https://discuss.elastic.co/u/Admin_Hack)\
**Post date:** [October 25, 2018, 12:10pm UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/9 "2018-10-25T12:10:40Z")

</div>

If you simply want to decrease the amount of memory that Elasticsearch is  
using, you need to change your heap size (via the HEAP\_SIZE environment  
variable). That controls the total memory allocated to Elasticsearch.

Echoing what Binh said...try not to change the field-data settings unless  
you know what you are doing. You should not enable soft references for  
field-data, this is a very bad option. It causes excessive GC thrashing  
and is not needed (especially now that 1.0 has circuit breaker logic built  
in). Similarly, the time expiration on field-data is typically a poor  
option, since it unnecessarily thrashes the GC too.  
You can also increase the swap storage space or install add swap memory. 🙂

---

<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:** [November 22, 2018, 12:10pm UTC](https://discuss.elastic.co/t/if-there-are-any-config-for-garbage-collection-in-elastic-search/153953/10 "2018-11-22T12:10:41Z")

</div>

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