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
|