# What is the purpose of setting "thread" value in heartbeat plugin?

**URL:** https://discuss.elastic.co/t/what-is-the-purpose-of-setting-thread-value-in-heartbeat-plugin/192605
**Category:** Logstash
**Created:** [July 29, 2019, 5:54am UTC](https://discuss.elastic.co/t/what-is-the-purpose-of-setting-thread-value-in-heartbeat-plugin/192605 "2019-07-29T05:54:52Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![garima](https://avatars.discourse-cdn.com/v4/letter/g/59ef9b/32.png) [@garima](https://discuss.elastic.co/u/garima)
#### Post date: [July 29, 2019, 5:54am UTC](https://discuss.elastic.co/t/what-is-the-purpose-of-setting-thread-value-in-heartbeat-plugin/192605/1 "2019-07-29T05:54:52Z")

</div>

Hi Team,

[Using Logstash version: 6.4.1]

I have some queries regarding heartbeat plugin.

I have configured heartbeat plugin with "threads" parameter, as per the specification mentioned on elastic official site, Kindly refer to below URL for the reference:

URL:  
[Heartbeat input plugin | Logstash Reference [6.4] | Elastic](https://www.elastic.co/guide/en/logstash/6.4/plugins-inputs-heartbeat.html#plugins-inputs-heartbeat-threads)

The default value for threads parameter is 1 as mentioned in above URL.

While setting the value for threads parameter to N (N= 1, 2, 3 ..... any number), N number of  
threads for heartbeat messages are being created, in other words N similar (duplicate) heartbeat messages are being created.

Below is the snippet of logstash.conf and debug log.

=============logstash.conf====================

> input {  
> heartbeat {  
> message =\> "Logstash works properly"  
> threads =\> 2  
> }  
> }  
> output {  
> stdout {}  
> }  
> ============================================

================Output of Logstash debug logs================

> _[2019-06-24T10:05:34,705][DEBUG][logstash.pipeline] filter received {"event"=\>{"message"=\>"Logstash works properly", "@timestamp"=\>2019-06-24T04:35:34.564Z, "host"=\>"node1", "@version"=\>"1"}}_  
> _[2019-06-24T10:05:34,706][DEBUG][logstash.pipeline] filter received {"event"=\>{"message"=\>"Logstash works properly", "@timestamp"=\>2019-06-24T04:35:34.599Z, "host"=\>"node1", "@version"=\>"1"}}_  
> _[2019-06-24T10:05:34,710][DEBUG][logstash.pipeline] output received {"event"=\>{"message"=\>"Logstash works properly", "@timestamp"=\>2019-06-24T04:35:34.532Z, "host"=\>"node1", "@version"=\>"1"}}_  
> _[2019-06-24T10:05:34,715][DEBUG][logstash.pipeline] output received {"event"=\>{"message"=\>"Logstash works properly", "@timestamp"=\>2019-06-24T04:35:34.536Z, "host"=\>"node1", "@version"=\>"1"}}_  
> =============================================

But I am not getting the clarity on below points, as no much information is given in official documents.

I am not getting the exact scenario or deployment where Logstash heartbeat plugin can be used while setting threads parameter to 2 or even more, in other words, What is the purpose of setting the "threads" value 2 or more than 2 ?

Regards,  
Garima

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [July 30, 2019, 12:48pm UTC](https://discuss.elastic.co/t/what-is-the-purpose-of-setting-thread-value-in-heartbeat-plugin/192605/2 "2019-07-30T12:48:23Z")

</div>

> [@garima](#):
>
> What is the purpose of setting the "threads" value 2 or more than 2 ?

The threads option gets inheritied from the threadable class, which the heartbeat input is based on. Setting it to more than 1 'is the same as declaring the input multiple times'. The only use I can think of is if you want a higher message rate than a single thread can produce.

---

<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: [August 27, 2019, 12:48pm UTC](https://discuss.elastic.co/t/what-is-the-purpose-of-setting-thread-value-in-heartbeat-plugin/192605/3 "2019-08-27T12:48:29Z")

</div>

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