# What is the correct unit to specify for threhold of GC Overhead?

**URL:** <https://discuss.elastic.co/t/what-is-the-correct-unit-to-specify-for-threhold-of-gc-overhead/162465>\
**Category:** Elasticsearch\
**Created:** [December 31, 2018, 1:33am UTC](https://discuss.elastic.co/t/what-is-the-correct-unit-to-specify-for-threhold-of-gc-overhead/162465 "2018-12-31T01:33:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YuWatanabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuwatanabe/32/13259_2.png) [@YuWatanabe](https://discuss.elastic.co/u/YuWatanabe)\
**Post date:** [December 31, 2018, 1:33am UTC](https://discuss.elastic.co/t/what-is-the-correct-unit-to-specify-for-threhold-of-gc-overhead/162465/1 "2018-12-31T01:33:13Z")

</div>

I would like to ask question about threshold setting for _GC Overehead_ .

I checked this on elasticsearch _v 6.4.2_ .

I am testing the GC setting to understand the concept of threshold of _GC Overhead_ and _GC Collections._

Looking at the [code](https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/monitor/jvm/JvmGcMonitorService.java) , I was able to setup each setting as below. Values are defaults.

```
# GC Logging
monitor.jvm.gc.collector.young.warn: 1000ms
monitor.jvm.gc.collector.young.info: 700ms
monitor.jvm.gc.collector.young.debug: 400ms

monitor.jvm.gc.collector.old.warn: 10000ms
monitor.jvm.gc.collector.old.info: 5000ms
monitor.jvm.gc.collector.old.debug: 2000ms

monitor.jvm.gc.overhead.warn: 100
monitor.jvm.gc.overhead.info: 25
monitor.jvm.gc.overhead.debug: 10

```

Looking at the code, _GC Overhead_ seems to be compared with _percentage_.

```
# GC Overhead is compared with "fraction". "fraction" is the amount of total time spend for Collections from last time GC stats was monitored.
 
void checkGcOverhead(final long current, final long elapsed, final long seq) {
  final int fraction = (int) ((100 * current) / (double) elapsed);
    Threshold overheadThreshold = null;
    if (fraction >= gcOverheadThreshold.warnThreshold) {
      overheadThreshold = Threshold.WARN;
    } else if (fraction >= gcOverheadThreshold.infoThreshold) {
      overheadThreshold = Threshold.INFO;
    } else if (fraction >= gcOverheadThreshold.debugThreshold) {
      overheadThreshold = Threshold.DEBUG;
    }
    if (overheadThreshold != null) {
      onGcOverhead(overheadThreshold, current, elapsed, seq);
    }
}

```

So , is it correct to understand that you need to specify the threshold of _GC Overhead_ in percentage ?

I appreciate if I could get some help with my question.

---

<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:** [December 31, 2018, 8:46am UTC](https://discuss.elastic.co/t/what-is-the-correct-unit-to-specify-for-threhold-of-gc-overhead/162465/2 "2018-12-31T08:46:08Z")

</div>

> [@YuWatanabe](#):
>
> So , is it correct to understand that you need to specify the threshold of _GC Overhead_ in percentage ?

Yes.

---

<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:** [January 28, 2019, 8:46am UTC](https://discuss.elastic.co/t/what-is-the-correct-unit-to-specify-for-threhold-of-gc-overhead/162465/3 "2019-01-28T08:46:10Z")

</div>

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