thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curtis Spencer <tho...@gmail.com>
Subject Re: Help Debugging Periodic Error
Date Thu, 07 May 2009 00:18:33 GMT
On Wed, May 6, 2009 at 4:28 PM, Ted Dunning <ted.dunning@gmail.com> wrote:
> This sounds like it is the opposite problem.  Your connection is probably
> being closed for you somehow after being idle.
>
> Depending on your speed requirements, you can re-open the transport for each
> burst of activity or you can use a pooling strategy to close idle
> connections and re-open them when you need to do more work.

Ted,

I am going through this execution path on every request in my app server:

 shared_ptr<TSocket> socket(new TSocket(host_name,port)));
 socket->setConnTimeout(THRIFT_TIMEOUT);  // Which Equals 10000
 socket->setRecvTimeout(THRIFT_TIMEOUT);
 shared_ptr<TTransport> transport(new TBufferedTransport(socket));
 shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
 MyClient client(protocol);
 try {
   transport->open();
   client.mycall(results);
   transport->close();
 } catch (TException &tx) {
   cerr << "Caught Exception" << endl;
 }

Wouldn't that be opening the transport anew each time?  So it
shouldn't be keeping any connections open correct?

I have found the performance to be fine, without worrying about a
connection pooling strategy, although that is a question for another
day.

-Curtis

Mime
View raw message