# Monitor GC duration/count

**URL:** <https://discuss.elastic.co/t/monitor-gc-duration-count/176183>\
**Category:** Elasticsearch\
**Created:** [April 10, 2019, 9:32am UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183 "2019-04-10T09:32:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Beuhlet\_Reseau](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@Beuhlet\_Reseau](https://discuss.elastic.co/u/Beuhlet_Reseau)\
**Post date:** [April 10, 2019, 9:32am UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/1 "2019-04-10T09:32:12Z")

</div>

Hello,

I want know  
how many GC are executed in last 5 min  
how long duration's GC is ?

I want use : GET /\_nodes/elasticsearch\_instance1/stats/jvm :  
Output return :

```
      "jvm": {
    "timestamp": 1554888379405,
    "uptime_in_millis": 56643256,
    "mem": {
      "heap_used_in_bytes": 16247615560,
      "heap_used_percent": 50,
      "heap_committed_in_bytes": 32212254720,
      "heap_max_in_bytes": 32212254720,
      "non_heap_used_in_bytes": 115543704,
      "non_heap_committed_in_bytes": 122445824,
      "pools": {
        "young": {
          "used_in_bytes": 14663286784,
          "max_in_bytes": 0,
          "peak_used_in_bytes": 18001952768,
          "peak_max_in_bytes": 0
        },
        "survivor": {
          "used_in_bytes": 109051904,
          "max_in_bytes": 0,
          "peak_used_in_bytes": 385875968,
          "peak_max_in_bytes": 0
        },
        "old": {
          "used_in_bytes": 1475276872,
          "max_in_bytes": 32212254720,
          "peak_used_in_bytes": 1475276872,
          "peak_max_in_bytes": 32212254720
        }
      }
    },
    "gc": {
      "collectors": {
        "young": {
          "collection_count": 22,
          "collection_time_in_millis": 1462
        },
        "old": {
          "collection_count": 0,
          "collection_time_in_millis": 0
        }
      }
    },
indent preformatted text by 4 spaces

```

So, i don't understand return values ?

My final aim is to put value is a text file to create graph about it :

exemple :

```
date_every_5min ; instances es ; nbre gc ; average duration gc
100419_11_30 ; elasticsearch_instance1; 10 ; 100ms
100419_11_30 ; elasticsearch_instance2; 5 ; 60ms
100419_11_35 ; elasticsearch_instance3; 7 ; 70ms
100419_11_35 ; elasticsearch_instance1; 7 ; 35ms
100419_11_35 ; elasticsearch_instance2; 3 ; 86ms
...

```

Is possible ?

---

<div class="post-metadata">

**Author:** ![Beuhlet\_Reseau](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@Beuhlet\_Reseau](https://discuss.elastic.co/u/Beuhlet_Reseau)\
**Post date:** [April 10, 2019, 9:36am UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/2 "2019-04-10T09:36:11Z")

</div>

> [@Beuhlet\_Reseau](#):
>
> "gc": { "collectors": { "young": { "collection\_count": 22, "collection\_time\_in\_millis": 1462 }, "old": { "collection\_count": 0, "collection\_time\_in\_millis": 0 }

For example, what represente value in count ? For the current day ? Last XX minutes ?

Same on :

```auto
          "collection_time_in_millis": 1462

```

This is the duration of GC young, but it is duration for the current day ? (so i must divise this value by the number of hour in the day ?)

---

<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:** [April 10, 2019, 10:13am UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/3 "2019-04-10T10:13:02Z")

</div>

The GC statistics you list are all cumulative, increasing from zero since the node was started. If you want to measure statistics over a time period then you should measure the values at the start and end of the time period and subtract them.

---

<div class="post-metadata">

**Author:** ![Beuhlet\_Reseau](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@Beuhlet\_Reseau](https://discuss.elastic.co/u/Beuhlet_Reseau)\
**Post date:** [April 10, 2019, 10:22am UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/4 "2019-04-10T10:22:59Z")

</div>

Waw it's not intuitive.

My node started 08/04/2019 at 8.00 am.  
=\> Currently its have 22 count and 1462 ms of duration  
If i follow you, average day : 11,5 count et 731 ms of duration (so 65 ms by gc)

It's possible to use monitor metrics to create this type of visualization on Kibana ?

---

<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:** [April 10, 2019, 10:36am UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/5 "2019-04-10T10:36:37Z")

</div>

> [@Beuhlet\_Reseau](#):
>
> Waw it's not intuitive.

Reporting cumulative statistics like this is pretty common, see e.g. [/proc/diskstats](https://www.infradead.org/~mchehab/kernel_docs/unsorted/iostats.html), [/proc/net/dev](http://man7.org/linux/man-pages/man5/proc.5.html), [Postgres statistics](https://www.postgresql.org/docs/10/monitoring-stats.html) and many more. It would be much less intuitive (and much more computationally expensive) for these numbers to represent events within some arbitrary time window.

> [@Beuhlet\_Reseau](#):
>
> It's possible to use monitor metrics to create this type of visualization on Kibana ?

Yes, see [https://www.elastic.co/guide/en/kibana/master/timelion-math.html](https://www.elastic.co/guide/en/kibana/master/timelion-math.html) for an example.

---

<div class="post-metadata">

**Author:** ![Beuhlet\_Reseau](https://avatars.discourse-cdn.com/v4/letter/b/e95f7d/32.png) [@Beuhlet\_Reseau](https://discuss.elastic.co/u/Beuhlet_Reseau)\
**Post date:** [April 10, 2019, 12:44pm UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/6 "2019-04-10T12:44:20Z")

</div>

I use free X-Pack (on 5).

In, Nodes, Advanced, i can see 2 graph very interesting :

GC Count and GC Duration on nodes. How to reproduce the same with curl API from shell.

I want that, because free X-Pack have 7 days of retention. I want store more days, so i must use log file in Linux.

---

<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:** [April 10, 2019, 12:48pm UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/7 "2019-04-10T12:48:06Z")

</div>

> [@Beuhlet\_Reseau](#):
>
> I want that, because free X-Pack have 7 days of retention. I want store more days, so i must use log file in Linux.

7 days is the default for [`xpack.monitoring.history.duration`](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/monitoring-settings.html#monitoring-collection-settings) but if you want to retain more data then you can increase this setting. The basic X-pack licence doesn't limit the amount of data you can retain as far as I can tell.

---

<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:** [May 8, 2019, 12:48pm UTC](https://discuss.elastic.co/t/monitor-gc-duration-count/176183/8 "2019-05-08T12:48:13Z")

</div>

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