# Good practice to create TransportClient

**URL:** <https://discuss.elastic.co/t/good-practice-to-create-transportclient/25344>\
**Category:** Elasticsearch\
**Created:** [July 10, 2015, 6:45pm UTC](https://discuss.elastic.co/t/good-practice-to-create-transportclient/25344 "2015-07-10T18:45:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Gowda](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@Pradeep\_Gowda](https://discuss.elastic.co/u/Pradeep_Gowda)\
**Post date:** [July 10, 2015, 6:45pm UTC](https://discuss.elastic.co/t/good-practice-to-create-transportclient/25344/1 "2015-07-10T18:45:24Z")

</div>

Hi All,  
Currently, in my project, I am creating new TransportClient for each query request and have some fixed number of clients to insert records into ES. Query request can come at any time but insertion happens once in 10min(may go upto ~150000 documents ). I was wondering if I can handle all this using single singleton client. If so do I need to modify the client settings such as thread pool size? Will single client handle all this operation? How to recover singleton transport client when there is NoNodeAvailable Exception? Can some one please guide me through best practices to create transport client?

Thanks

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 10, 2015, 8:03pm UTC](https://discuss.elastic.co/t/good-practice-to-create-transportclient/25344/2 "2015-07-10T20:03:05Z")

</div>

Yes please. One single client per JVM. It's threadsafe.

---

<div class="post-metadata">

**Author:** ![Pradeep\_Gowda](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@Pradeep\_Gowda](https://discuss.elastic.co/u/Pradeep_Gowda)\
**Post date:** [July 10, 2015, 8:54pm UTC](https://discuss.elastic.co/t/good-practice-to-create-transportclient/25344/3 "2015-07-10T20:54:33Z")

</div>

Thank you very much for your quick response.  
What if this client fails because of NoNodeAvailable Exception. How to recover the client?

---

<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, 12:02am UTC](https://discuss.elastic.co/t/good-practice-to-create-transportclient/25344/4 "2017-07-06T00:02:13Z")

</div>


