# What exactly do the thread-limits and queue-size for search-thread-pools indicate

**URL:** <https://discuss.elastic.co/t/what-exactly-do-the-thread-limits-and-queue-size-for-search-thread-pools-indicate/127843>\
**Category:** Elasticsearch\
**Created:** [April 12, 2018, 2:53pm UTC](https://discuss.elastic.co/t/what-exactly-do-the-thread-limits-and-queue-size-for-search-thread-pools-indicate/127843 "2018-04-12T14:53:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dominik\_Stadler](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@Dominik\_Stadler](https://discuss.elastic.co/u/Dominik_Stadler)\
**Post date:** [April 12, 2018, 2:53pm UTC](https://discuss.elastic.co/t/what-exactly-do-the-thread-limits-and-queue-size-for-search-thread-pools-indicate/127843/1 "2018-04-12T14:53:51Z")

</div>

We are seeing some EsRejectedException in the form of "rejected execution of ... on EsThreadPoolExecutor[search, queue capacity = 1000, ... [Running, pool size = 4, active threads = 4, queued tasks = 1000, completed tasks = 128865868]]]

The reason of the exception is clear, we have only 4 search threads and all of them were busy for long enough to have 1000 queries accumulate and thus queries are rejected by Elasticsearch to not grow the queue endlessly.

What I would like to find out is what the "work-item" in the threads and queue actually indicate. Is every item one full query, which can access many different indices and shards? Or is each item in the queue actually an access to a single shard.

This is important information, because in the first case, one query which takes forever cannot block all available threads, but in the second case it can, because the query would typically spread out into a number of shard-level-queries.

I read documentation at [https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-threadpool.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-threadpool.html) and the blog post at [https://qbox.io/blog/thread-pools-elasticsearch-search-request-errors](https://qbox.io/blog/thread-pools-elasticsearch-search-request-errors), but that does not seem to answer this.

I would think it will be the second case, i.e. each accessed shard uses up one item, but I a more definite answer would be very nice, indeed.

Anybody knows or where in the code would I be able to find out?

Thanks... Dominik.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [April 13, 2018, 2:27am UTC](https://discuss.elastic.co/t/what-exactly-do-the-thread-limits-and-queue-size-for-search-thread-pools-indicate/127843/2 "2018-04-13T02:27:20Z")

</div>

> [@Dominik\_Stadler](#):
>
> Or is each item in the queue actually an access to a single shard.

Yes.

---

<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 11, 2018, 2:27am UTC](https://discuss.elastic.co/t/what-exactly-do-the-thread-limits-and-queue-size-for-search-thread-pools-indicate/127843/3 "2018-05-11T02:27:39Z")

</div>

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