# How to monitor the memory cost of a query?

**URL:** <https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911>\
**Category:** Elastic Cloud Enterprise (ECE)\
**Created:** [September 25, 2018, 10:57pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911 "2018-09-25T22:57:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankurlathwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankurlathwal/32/35879_2.png) [@ankurlathwal](https://discuss.elastic.co/u/ankurlathwal)\
**Post date:** [September 25, 2018, 10:57pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/1 "2018-09-25T22:57:55Z")

</div>

Our ECE cluster JVM memory gets stacked up almost every day now. Sometimes, I see that the number of requests at a particular time rockets up to 15k (with around 14.5k being indexing requests). But the cluster has also auto-restarted when the total requests were close to 500 (250 search and 250 indexing). I suspect that there is some certain kind of request that is consuming multiple amounts of memory compared to the other requests. To help me narrow down the culprit, can someone suggest a way how I can how much affect one kind of request have one the memory? Or basically, how can I calculate the cost/request?  
Suggestions are welcome.

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [September 26, 2018, 1:36pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/2 "2018-09-26T13:36:40Z")

</div>

Hi @ankurlathwal

You'll get a better general answer in the Elasticsearch forum, since ECE is mostly neutral to how memory consumption works, aside from providing options to change the YAML settings (or more rarely JVM CLI params) via the UI or API.

You can use options such as those described here: [https://www.elastic.co/guide/en/elasticsearch/guide/current/\_limiting\_memory\_usage.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/_limiting_memory_usage.html) to make searches fail instead of stacking the JVM, and to get some idea what the memory usage of the different elements of the indices.

Alex

---

<div class="post-metadata">

**Author:** ![ankurlathwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankurlathwal/32/35879_2.png) [@ankurlathwal](https://discuss.elastic.co/u/ankurlathwal)\
**Post date:** [September 26, 2018, 4:06pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/3 "2018-09-26T16:06:43Z")

</div>

Hi Alex.  
Thanks a for replying. Very useful article. I was trying to update fielddata.cache.size but couldn't update using kibana

> "reason": "persistent setting [indices.fielddata.cache.size], not dynamically updateable

Do you have any idea how can I update this setting on the cloud? Is there a way to access the .yaml settings file?

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [September 26, 2018, 4:18pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/4 "2018-09-26T16:18:02Z")

</div>

@ankurlathwal - yep .. in the cluster edit page in ECE there is a YAML box for user settings, simply put it in there and re-apply the plan to load new ES containers with those settings

Alex

---

<div class="post-metadata">

**Author:** ![ankurlathwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankurlathwal/32/35879_2.png) [@ankurlathwal](https://discuss.elastic.co/u/ankurlathwal)\
**Post date:** [September 26, 2018, 4:18pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/5 "2018-09-26T16:18:38Z")

</div>

Cool. Actually just found it. Thanks a lot BTW.

---

<div class="post-metadata">

**Author:** ![ankurlathwal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankurlathwal/32/35879_2.png) [@ankurlathwal](https://discuss.elastic.co/u/ankurlathwal)\
**Post date:** [September 26, 2018, 4:21pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/6 "2018-09-26T16:21:45Z")

</div>

Okay. Stuck again. I am trying to apply "indices.fielddata.cache.size" setting but looks like it's not allowed.  
[https://www.elastic.co/guide/en/cloud/saas-release/ec-add-user-settings.html](https://www.elastic.co/guide/en/cloud/saas-release/ec-add-user-settings.html)

How do I apply this setting?

---

<div class="post-metadata">

**Author:** ![Alex\_Piggott](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_piggott/32/11053_2.png) [@Alex\_Piggott](https://discuss.elastic.co/u/Alex_Piggott)\
**Post date:** [September 26, 2018, 6:26pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/7 "2018-09-26T18:26:33Z")

</div>

@ankurlathwal are you on your own ECE instance (ie private cloud) or ESS (formerly known as Elastic Cloud, ie our SaaS/public cloud)?

If the former, the setting should be allowed, if the latter then you can open a support ticket and request the change be applied for you (ie an admin sanity checks it then applies it)

Alex

---

<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:** [October 10, 2018, 6:26pm UTC](https://discuss.elastic.co/t/how-to-monitor-the-memory-cost-of-a-query/149911/8 "2018-10-10T18:26:36Z")

</div>

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