# Elasticsearch Search Threads not making sense

**URL:** <https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699>\
**Category:** Elasticsearch\
**Created:** [January 30, 2018, 7:56pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699 "2018-01-30T19:56:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![djtecha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djtecha/32/54011_2.png) [@djtecha](https://discuss.elastic.co/u/djtecha)\
**Post date:** [January 30, 2018, 7:56pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/1 "2018-01-30T19:56:53Z")

</div>

So, I am seeing interesting metrics that don't really make much sense to me. Given I'm using the datadog integration that tells me these details, but they seem accurate with everything else so I have confidence in the numbers. Anyway, I am seeing a case where the number of active search threads by host doesn't exceed 2 threads, and yet I have the search thread queue increasing over 1. From my understanding the search thread queue is only there to act as a buffer so that large querying can simply slow down and not outright fail. Am I misunderstanding this in the documentation?

`The queue_size allows to control the initial size of the queue of pending requests that have no threads to execute them`

---

<div class="post-metadata">

**Author:** ![djtecha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djtecha/32/54011_2.png) [@djtecha](https://discuss.elastic.co/u/djtecha)\
**Post date:** [January 30, 2018, 7:58pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/2 "2018-01-30T19:58:17Z")

</div>

Furthermore, I was noticing mild lag in kibana which got me digging into this. Upon increasing that number to 30 threads per host my cluster seems to be performing much better on 2TB of data.

---

<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:** [February 2, 2018, 3:47am UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/3 "2018-02-02T03:47:04Z")

</div>

Your understanding is correct.

> [@djtecha](#):
>
> Upon increasing that number to 30 threads per host

It's not that easy though, you may have faster searches but you are taking resources from other areas that adversely impact operations.

---

<div class="post-metadata">

**Author:** ![djtecha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djtecha/32/54011_2.png) [@djtecha](https://discuss.elastic.co/u/djtecha)\
**Post date:** [February 2, 2018, 6:23pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/4 "2018-02-02T18:23:22Z")

</div>

But then why would I never see the active search threads max out? Why would the queue get filled at all?

---

<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:** [February 2, 2018, 8:55pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/5 "2018-02-02T20:55:00Z")

</div>

Basically, this implies the node is overloaded and you're asking too much of it.

---

<div class="post-metadata">

**Author:** ![djtecha](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djtecha/32/54011_2.png) [@djtecha](https://discuss.elastic.co/u/djtecha)\
**Post date:** [February 2, 2018, 8:56pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/6 "2018-02-02T20:56:40Z")

</div>

I would agree if my active search threads ever grew about 2, when my CPU count is 8. (8\*3)/2+1 = 13 Which is why i'm confused here.

---

<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:** [March 2, 2018, 8:57pm UTC](https://discuss.elastic.co/t/elasticsearch-search-threads-not-making-sense/117699/7 "2018-03-02T20:57:14Z")

</div>

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