# High CPU consumption

**URL:** https://discuss.elastic.co/t/high-cpu-consumption/25289
**Category:** Elasticsearch
**Created:** [July 10, 2015, 7:02am UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289 "2015-07-10T07:02:06Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)
#### Post date: [July 10, 2015, 7:02am UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/1 "2015-07-10T07:02:06Z")

</div>

Hello,  
I'm experiencing very high CPU usage, nearly 100%. The documentation says that ES is light on CPU. I assume that it could be some heavy queries. But how can I prove it and find what queries are eating CPU?  
I've ran hot\_threads:

> <https://gist.github.com/strokine/dc209dacbebf958fd0be>

But I don't understand what could be the problem here?  
Please help,  
Thanks,  
Eugene

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [July 10, 2015, 7:38am UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/2 "2015-07-10T07:38:57Z")

</div>

Looks like you may have an overloaded cluster, can you add another node?

---

<div class="post-metadata">

### Author: ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)
#### Post date: [July 10, 2015, 11:25am UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/3 "2015-07-10T11:25:56Z")

</div>

Thanks, looks like it is the case, I've added another node, CPU usage dropped.  
Out of curiosity, did you get to this conclusion based on the hot\_threads info? If so, what exactly shows the overload?  
Thanks,  
Eugene

---

<div class="post-metadata">

### Author: ![Harlin\_ES](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@Harlin\_ES](https://discuss.elastic.co/u/Harlin_ES)
#### Post date: [July 10, 2015, 4:08pm UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/4 "2015-07-10T16:08:21Z")

</div>

Are any of the queries coming in sorted queries or aggregations?

---

<div class="post-metadata">

### Author: ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)
#### Post date: [July 10, 2015, 4:10pm UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/5 "2015-07-10T16:10:49Z")

</div>

We have a lot of sorted queries. This is the business needs. No aggregations though, as far as I can see.

---

<div class="post-metadata">

### Author: ![Harlin\_ES](https://avatars.discourse-cdn.com/v4/letter/h/977dab/32.png) [@Harlin\_ES](https://discuss.elastic.co/u/Harlin_ES)
#### Post date: [July 10, 2015, 4:21pm UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/6 "2015-07-10T16:21:04Z")

</div>

Sorted queries can cause issues with Elasticsearch if the cluster isn't prepared for them. (getting individual fields to sort on out of an inverted index is hard). ES has better ways of getting this field data. If you aren't already using one of these approaches I would high suggest either [eagerly loading field data](https://www.elastic.co/guide/en/elasticsearch/guide/current/preload-fielddata.html) or using [doc values](https://www.elastic.co/guide/en/elasticsearch/guide/current/doc-values.html)

---

<div class="post-metadata">

### Author: ![haochun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/haochun/32/24701_2.png) [@haochun](https://discuss.elastic.co/u/haochun)
#### Post date: [May 20, 2017, 6:29am UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/7 "2017-05-20T06:29:24Z")

</div>

@Eugene_Strokin i have encountered the same probole,did you find the cause?i want to find which query,but i have no way:sob:

---

<div class="post-metadata">

### Author: ![Eugene\_Strokin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eugene_strokin/32/1238_2.png) [@Eugene\_Strokin](https://discuss.elastic.co/u/Eugene_Strokin)
#### Post date: [May 29, 2017, 1:13am UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/8 "2017-05-29T01:13:01Z")

</div>

After careful investigation I noticed that a lot of sorted queries are running, and I assumed the Harlin's suggestion is correct. There is no way for me to change the queries, so I had to add shards and replicas to the number which pushed down the CPU usage to acceptable level, but still considerably high.

---

<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: [July 5, 2017, 9:59pm UTC](https://discuss.elastic.co/t/high-cpu-consumption/25289/9 "2017-07-05T21:59:55Z")

</div>


