# Need help in understanding script - compilations from \_nodes/stats

**URL:** <https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984>\
**Category:** Elasticsearch\
**Created:** [December 15, 2018, 12:23am UTC](https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984 "2018-12-15T00:23:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karthik\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Karthik\_Ramachandran](https://discuss.elastic.co/u/Karthik_Ramachandran)\
**Post date:** [December 15, 2018, 12:23am UTC](https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984/1 "2018-12-15T00:23:21Z")

</div>

Hi All,

We are getting circuit breaker exceptions on script compilations during watch deployment, and after increasing from default 75/5m to a higher value viz. 200/5s, it worked. But, wanted to check what is the exact number of scripts that were running given a time range. Used \_nodes/stats to check the state of nodes , which results something like below for each node

"script": {  
"compilations": \<Varied number for each node ranging from 2000 - 25000\>,  
"cache\_evictions": \<Varied number for each node ranging from 2000 - 25000\>  
}

I'm not sure how to read this. If it is 75/5m it should be failing for every deployment and every watch that is running behind. Any help in reading and understand how to get current compilations/minute would help.

NOTE: The CPU usage was less so we did not have any issue after increasing compilation rate.

---

<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 16, 2018, 9:12am UTC](https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984/2 "2018-12-16T09:12:35Z")

</div>

> [@Karthik\_Ramachandran](#):
>
> I'm not sure how to read this.

These numbers are cumulative totals. To work out the rate at which these things occur, you need to take two readings some time apart and subtract one from the other. [The derivative aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-derivative-aggregation.html) is one way to do this.

---

<div class="post-metadata">

**Author:** ![Karthik\_Ramachandran](https://avatars.discourse-cdn.com/v4/letter/k/f19dbf/32.png) [@Karthik\_Ramachandran](https://discuss.elastic.co/u/Karthik_Ramachandran)\
**Post date:** [December 17, 2018, 5:49pm UTC](https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984/3 "2018-12-17T17:49:35Z")

</div>

Thanks David. Given that it is cumulative, the first time when I use stats API, is it the number shown is from the time of cluster-node start. Please correct me.

---

<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 17, 2018, 6:14pm UTC](https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984/4 "2018-12-17T18:14:03Z")

</div>

> [@Karthik\_Ramachandran](#):
>
> is it the number shown is from the time of cluster-node start

Yes (in the `master` branch anyway, I haven't checked all versions). It is zero when the node starts, increases by 1 on each compilation, and is never reset to zero:

> <https://github.com/elastic/elasticsearch/blob/99f88f15c5febbca2d13b5b5fda27b844153bf1a/server/src/main/java/org/elasticsearch/script/ScriptMetrics.java#L24-L44>

---

<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 14, 2019, 6:14pm UTC](https://discuss.elastic.co/t/need-help-in-understanding-script-compilations-from-nodes-stats/160984/5 "2019-01-14T18:14:47Z")

</div>

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