# Facing Bulk queue rejection on index requests

**URL:** <https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426>\
**Category:** Elasticsearch\
**Created:** [August 1, 2017, 10:54pm UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426 "2017-08-01T22:54:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![darthburrito](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darthburrito/32/21632_2.png) [@darthburrito](https://discuss.elastic.co/u/darthburrito)\
**Post date:** [August 1, 2017, 10:54pm UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426/1 "2017-08-01T22:54:10Z")

</div>

Hi All,

## Stack trace

```auto
Error: [es_rejected_execution_exception] rejected execution of org.elasticsearch.transport.TransportService$7@1b3a4fac on EsThreadPoolExecutor[bulk, queue capacity = 1000, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@334cd586[Running, pool size = 4, active threads = 4, queued tasks = 1000, completed tasks = 6853221]]
        at respond (/app/node_modules/elasticsearch/src/lib/transport.js:307:15)
        at checkRespForFailure (/app/node_modules/elasticsearch/src/lib/transport.js:266:7)
        at HttpConnector.<anonymous> (/app/node_modules/elasticsearch/src/lib/connectors/http.js:159:7)
        at IncomingMessage.bound (/app/node_modules/elasticsearch/node_modules/lodash/dist/lodash.js:729:21)
        at emitNone (events.js:110:20)
        at IncomingMessage.emit (events.js:207:7)
        at endReadableNT (_stream_readable.js:1047:12)
        at _combinedTickCallback (internal/process/next_tick.js:102:11)
        at process._tickDomainCallback (internal/process/next_tick.js:198:9)

```

## What am i doing

I am producing multiple concurrent client.index() requests from my node server to the ingest node

## Cluster config

- 1 ingest node (m4.2xl)
- 3 dedicated master nodes ( t2.small)
- 6 data nodes ( 15 gb heap, 850Gb ssd nvme) ( i3.xlarge)

## index settings

- shard\_count = 6
- replica = 1

## Question 😕

why does the stack trace say the `bulk` queue is full when i am using the client.index() api ?  
what is a good suggestion to handle these failures

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 4, 2017, 7:41am UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426/2 "2017-08-04T07:41:14Z")

</div>

if you send a single index request it gets converted to a bulk request internally. If you have many index requests going on, you should batch them together on the client side to not run into this problem.

Hope this helps.

--Alex

---

<div class="post-metadata">

**Author:** ![zqc0512](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zqc0512/32/32141_2.png) [@zqc0512](https://discuss.elastic.co/u/zqc0512)\
**Post date:** [August 4, 2017, 7:45am UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426/3 "2017-08-04T07:45:07Z")

</div>

change the bulk size with es (cpu cores.) and the queue line about bulk size  
`https://www.elastic.co/guide/en/elasticsearch/reference/5.4/modules-threadpool.html#modules-threadpool`

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 6, 2017, 8:51pm UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426/4 "2017-08-06T20:51:22Z")

</div>

Changing thread pool size or queue size is just a tradeoff by requiring more Elasticsearch memory to survive this issue longer, but does not solve fundamentlly the underlying problem.

---

<div class="post-metadata">

**Author:** ![darthburrito](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/darthburrito/32/21632_2.png) [@darthburrito](https://discuss.elastic.co/u/darthburrito)\
**Post date:** [August 10, 2017, 6:37pm UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426/5 "2017-08-10T18:37:17Z")

</div>

thank you Alex, i was able to resolve this issue by using bulk api and throttling the number or requests on the application end

---

<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:** [September 7, 2017, 6:37pm UTC](https://discuss.elastic.co/t/facing-bulk-queue-rejection-on-index-requests/95426/6 "2017-09-07T18:37:32Z")

</div>

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