# Garbage Collection initialisation

**URL:** <https://discuss.elastic.co/t/garbage-collection-initialisation/104732>\
**Category:** Elasticsearch\
**Created:** [October 20, 2017, 4:07pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732 "2017-10-20T16:07:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [October 20, 2017, 4:07pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732/1 "2017-10-20T16:07:32Z")

</div>

Hello, from reading the documentation garbage collection will occur if the JVM heap percentage is 75% or above - I'm wondering does GC happen _as soon as_ 75% is reached or does it need to spend some time at 75% or above before GC is initialised?

I only ask because on some of our nodes the JVM heap usage does reach 75% but only briefly.

Thanks.

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [October 22, 2017, 3:16pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732/2 "2017-10-22T15:16:40Z")

</div>

It is as soon as it hits 75%. The JVM heap usage only drops because of GC, so if you see that it reaches 75% and drops right after, that drop was because of GC.

That is a normal operation, BTW. It should only a problem if, every time it drops, the previous minimum heap is not restored/repeated (i.e the new minimum is higher than the last).

---

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [October 22, 2017, 6:50pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732/3 "2017-10-22T18:50:42Z")

</div>

Hello, thanks very much for the reply; I have one last question - if I am hitting a GC then from what I've read elasticsearch stops, no code is executing - does that mean that logs sent to elasticsearch are potentially being dropped?

---

<div class="post-metadata">

**Author:** ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)\
**Post date:** [October 22, 2017, 7:46pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732/4 "2017-10-22T19:46:57Z")

</div>

The behavior you are describing is called GC (or memory) pressure. Normally, GC happens really fast (just a few milliseconds) and that is not a problem.

It will only become a problem if it takes seconds to minutes to execute and that situation will be visible in the logs as a WARN message. Still, it doesn't necessarily means you are losing logs, unless you are using clients that can not handle backpressure (Logstash and Beats can do it).

---

<div class="post-metadata">

**Author:** ![kernelpanic](https://avatars.discourse-cdn.com/v4/letter/k/c89c15/32.png) [@kernelpanic](https://discuss.elastic.co/u/kernelpanic)\
**Post date:** [October 22, 2017, 8:05pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732/5 "2017-10-22T20:05:49Z")

</div>

Ok thanks, I'm using logstash / beats so hopefully I'm not losing any logs, I'll keep any eye out for any WARN messages

---

<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 19, 2017, 8:06pm UTC](https://discuss.elastic.co/t/garbage-collection-initialisation/104732/6 "2017-11-19T20:06:10Z")

</div>

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