# Elasticsearch output plugin: "workers" setting

**URL:** <https://discuss.elastic.co/t/elasticsearch-output-plugin-workers-setting/43644>\
**Category:** Logstash\
**Created:** [March 7, 2016, 11:10am UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-workers-setting/43644 "2016-03-07T11:10:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mguiwin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mguiwin/32/6743_2.png) [@mguiwin](https://discuss.elastic.co/u/mguiwin)\
**Post date:** [March 7, 2016, 11:10am UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-workers-setting/43644/1 "2016-03-07T11:10:28Z")

</div>

Hello,

If I understand well what is described in the [Logstash Processing Pipeline article] ([https://www.elastic.co/guide/en/logstash/current/pipeline.html](https://www.elastic.co/guide/en/logstash/current/pipeline.html)) , it might be that the number of ES output plugin workers (as defined by the 'workers' setting of the ES output plugin) equals to:  
number of LS pipeline workers X ES output plugin workers

Could someone confirm please?

In general, how does increasing the "workers" setting of the Elasticsearch output plugin affect the performance? Should it be aligned with the pipeline-workers setting (it is set to ''1' by default)?

Thanks,  
MG

---

<div class="post-metadata">

**Author:** ![danygor](https://avatars.discourse-cdn.com/v4/letter/d/a8b319/32.png) [@danygor](https://discuss.elastic.co/u/danygor)\
**Post date:** [May 26, 2016, 8:49am UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-workers-setting/43644/2 "2016-05-26T08:49:41Z")

</div>

Hi,

I noticed that the workers setting in the elasticsearch output plugins directly affects the number of sockets the machine opens towards the elasticsearch nodes.

workers# = socket# **per ES host**

For example, if you set 3 ES data nodes under the "hosts" variable you will get:  
1 socket for each ES host if workers is 1 (default) --\> total of 3 open sockets  
2 socket for each ES host if workers is 2 --\> total of 6 open sockets  
3 socket for each ES host if workers is 3 --\> total of 9 open sockets

I'm not sure how this relates to the pipeline worker threads. I assume each thread will output the event it is handling to **each** output plugin it is supposed to reach, in our case the ES output plugin is among the reached ones. Subsequently, I believe the ES output plugin take the event and puts them in a queue, then it will pick from the queue and schedule a free socket to use among the ones it opened (as per the "workers" directive).

I'm not sure of it and would like to deepen my understanding on this specific topic.  
Can someone else help us?

Thanks,  
Daniele

---

<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 6, 2017, 4:56am UTC](https://discuss.elastic.co/t/elasticsearch-output-plugin-workers-setting/43644/3 "2017-07-06T04:56:08Z")

</div>


