# TransportClient Functionality

**URL:** https://discuss.elastic.co/t/transportclient-functionality/11502
**Category:** Elasticsearch
**Created:** [April 9, 2013, 11:16am UTC](https://discuss.elastic.co/t/transportclient-functionality/11502 "2013-04-09T11:16:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ElasticUsers](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@ElasticUsers](https://discuss.elastic.co/u/ElasticUsers)
#### Post date: [April 9, 2013, 11:16am UTC](https://discuss.elastic.co/t/transportclient-functionality/11502/1 "2013-04-09T11:16:37Z")

</div>

Hi Team,

We have a few questions regarding Transport Client functionality. On this forum we came to know that Transport Client is thread safe and it is build to be reused by several threads. We have a Java web application and till now we create one Transport Client instance per request. Now we are contemplating of having a single Transport Client serving multiple search requests from web application. We have 3 queries -

1. Should we create a pool of Transport Clients instead of having only one Client for entire application!

2. Suppose there is only one Transport Client for the entire app. How this one client instance will manage concurrent search requests. Will it serve only one search request at a time! Won't it slow down the searching as it has to handle multiple requests simultaneously. Please let us know the inner working of Transport Client.

3. Suppose we stick to one client per request, what would be the impact! Will it lead larger memory footprint?

Thanks

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [April 9, 2013, 12:57pm UTC](https://discuss.elastic.co/t/transportclient-functionality/11502/2 "2013-04-09T12:57:22Z")

</div>

1. Just create one transport client per JVM instance.

2. If you look closer at the API, you see that each request is being  
sent asynchronoulsy, so you can easily attach a response callback method  
to each request. This is very fast style of network communication. Of  
course, there is no slowdown if you send multiple requests without  
waiting for response, instead, the throughput will rise in a typical  
server environment.

3. The impact is not only footprint, it's the rendezvous overhead with  
the cluster, together with slower responses and less throughput. That is  
because you must also take care of the socket consumption. Note that  
each socket is also a file descriptor and each socket will be resident  
even after close for some minutes at the OS level to get eventually be  
reused. Also you won't have much joy with sniffing / failover, which is  
effectively not available if you immediately shut down the client after  
each request.

Jörg

Am 09.04.13 13:16, schrieb ElasticUsers:

> Hi Team,
> 
> We have a few questions regarding Transport Client functionality. On this  
> forum we came to know that Transport Client is thread safe and it is build  
> to be reused by several threads. We have a Java web application and till now  
> we create one Transport Client instance per request. Now we are  
> contemplating of having a single Transport Client serving multiple search  
> requests from web application. We have 3 queries -
> 
> 1. Should we create a pool of Transport Clients instead of having only one  
> Client for entire application!
> 
> 2. Suppose there is only one Transport Client for the entire app. How this  
> one client instance will manage concurrent search requests. Will it serve  
> only one search request at a time! Won't it slow down the searching as it  
> has to handle multiple requests simultaneously. Please let us know the inner  
> working of Transport Client.
> 
> 3. Suppose we stick to one client per request, what would be the impact!  
> Will it lead larger memory footprint?
> 
> Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![ElasticUsers](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@ElasticUsers](https://discuss.elastic.co/u/ElasticUsers)
#### Post date: [April 10, 2013, 4:50am UTC](https://discuss.elastic.co/t/transportclient-functionality/11502/3 "2013-04-10T04:50:26Z")

</div>

Hi Jörg,

Thanks for the information.

---

<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, 2:41am UTC](https://discuss.elastic.co/t/transportclient-functionality/11502/4 "2017-07-06T02:41:53Z")

</div>


