thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From BCG <>
Subject Re: How to make a Thrift client for multiple threads?
Date Tue, 07 Jun 2016 13:29:15 GMT

On 06/07/2016 07:54 AM, Matt Chambers wrote:
> Another way to do it would be to use ThreadLocal connections.
> <>
>> On Jun 7, 2016, at 6:14 AM, Daniel Wu <> wrote:
>> Thrift client/connection is not thread safe. Use a lock or object pool.
>> On 7/6/2016, 5:51 PM, "Tuan Le Dinh" <> wrote:
You might not see too much gain in simply pooling/locking/reusing 
clients, as the real overhead that you are trying to avoid (I presume) 
is the overhead of establishing connections.  Simply reusing THttpClient 
might not avoid this overhead.

In addition to (or perhaps instead of) reusing client instances you 
might want to investigate the connection pooling functionality built 
into Commons HTTP Components:

You could, for example, manually configure an HttpClient instance to use 
connection pooling and then just pass that instance to the 
THttpClient(String url, HttpClient client) constructor.

View raw message