# Java TransportClient: Number of threads

**URL:** <https://discuss.elastic.co/t/java-transportclient-number-of-threads/135462>\
**Category:** Elasticsearch\
**Created:** [June 12, 2018, 6:21am UTC](https://discuss.elastic.co/t/java-transportclient-number-of-threads/135462 "2018-06-12T06:21:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jul](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@Jul](https://discuss.elastic.co/u/Jul)\
**Post date:** [June 12, 2018, 6:21am UTC](https://discuss.elastic.co/t/java-transportclient-number-of-threads/135462/1 "2018-06-12T06:21:16Z")

</div>

Hey there,

I'm using the Java TransportClient in my application and I've noticed that one instance of my application creates a lot of threads to communicate with Elasticsearch:  
 ![screenshot_threads_es2](https://us1.discourse-cdn.com/elastic/original/3X/0/f/0f893f0693e50e39c3ad41a6530cc1ecac1eda68.png)  
I noticed that it creates twice as much transport\_client\_boss threads as there are CPUs.

This is a problem as we are running many instances of the application of the same server to connect to the same Elasticsearch node. We'd like to limit the number of threads.

I achived this by setting "processors" manually when creating the TransportClient:

```
Settings internalSettings = Settings.builder().put(..)
        .put("processors", 2)
        .build();
TransportClient client = new PreBuiltTransportClient(internalSettings);

```

I did this based on this recommendation: [https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html#processors](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-threadpool.html#processors)

The question now is: Are there any side effects? Do I need to adjust other settings as well? I could not find any documentation about it.

Thanks,  
Jul

---

<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 10, 2018, 6:21am UTC](https://discuss.elastic.co/t/java-transportclient-number-of-threads/135462/2 "2018-07-10T06:21:19Z")

</div>

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