thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Slee <ms...@fb.com>
Subject Re: reuse Ttransport or not ?
Date Thu, 19 Jul 2012 17:20:27 GMT
Agreed with Rush. A couple other considerations worth mentioning here:

- There is a bit of TCP overhead every time you create and then tear down
a connection, if you're trying to squeeze out really high performance and
this is the same client talking to the same server, it's preferable not to
pay that every time

- Re-using the client does mean that the socket is also held open longer
on the server side. Timeouts may come into play here if there are
significant delays between client calls. If your server specifies a read
timeout - it *will* close the client connection after that period elapses
with no new call being made.

So, as long as your server is not going to be maxed out on connections
from tons of different clients, it's generally preferable to re-use.

On 7/19/12 10:02 AM, "Rush Manbert" <rush@manbert.com> wrote:

>On Jul 18, 2012, at 11:45 PM, panfei wrote:
>
>> Hi all:
>> 
>> there maybe a lot of RPC calls from the client to the server, I want to
>> know , in this case, should I create a transport and keep it opened to
>>do
>> the RPC calls , or should I create a transport on every RPC call ? and
>>why
>> ? thanks !
>> 
>> 
>> -- 
>> 不学习,不知道
>
>On a *nix system, opening a transport for each RPC call uses a socket.
>When you close the transport, the system keeps the socket around for a
>while, so it is unavailable for re-use. Depending on the rate at which
>you make RPC calls, your system can get starved for sockets, and you will
>need to add retry logic to handle that. So it's better to open a single
>client and use it for multiple calls.
>
>I'm guessing you would see the same effect from a Windows client.
>
>- Rush

Mime
View raw message