Java transports buffer internally. there is no TBufferedTransport the way there is in C#.
(moving to user@) On Tue, Jun 8, 2010 at 10:31 AM, Subrata Roy <subrata....@openwave.com> wrote: > We are using Cassandra 0.6.2 with hector/thrift client, and our > application performance is really slow. We are not sure that it is > because of hector/thrift connection or not. Jonathan E. and other > people has suggested that using "TBuffferedTransport(TSocket) instead of > a TSocket directly" performance has drastically improved. If that is > the case, why TBuffferedTransport (TSocket) is not added as part of the > hector client by default? Is there any technical reason not to add as > part of the Cassandra 0.6.2/ hector-0.6.0-13 release? > > > > Thanks in advance for your valuable input. > > > > Regards > > Subrata > > > > /// Code snippet from Hector client: CassandraClientFactory.java > > > > private Cassandra.Client createThriftClient(String url, int port) > > throws TTransportException , TException { > > log.debug("Creating a new thrift connection to {}:{}", url, port); > > TTransport tr; > > if (useThriftFramedTransport) { > > tr = new TFramedTransport(new TSocket(url, port, timeout)); > > } else { > > tr = new TSocket(url, port, timeout); --- change to > TBuffferedTransport () for better performance > > } > > TProtocol proto = new TBinaryProtocol(tr); > > Cassandra.Client client = new Cassandra.Client(proto); > > try { > > tr.open(); > > } catch (TTransportException e) { > > // Thrift exceptions aren't very good in reporting, so we have to > catch the exception here and > > // add details to it. > > log.error("Unable to open transport to " + url + ":" + port, e); > > clientMonitor.incCounter(Counter.CONNECT_ERROR); > > throw new TTransportException("Unable to open transport to " + url > + ":" + port + " , " + > > e.getLocalizedMessage(), e); > > } > > return client; > > } > > > > > > > > -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of Riptano, the source for professional Cassandra support http://riptano.com