You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Tristan Tarrant <tr...@gmail.com> on 2010/10/26 16:22:58 UTC
Cassandra Connection Pool
Dear all,
first of all let me introduce myself (or rather what I do). I am the
developer of the Infinispan Cassandra CacheStore (
http://community.jboss.org/wiki/CassandraCacheStore) which allows
persistence of Infinispan's cache to Cassandra's keyspaces. While developing
the cachestore I needed a connection pool for managing thrift connections.
Since none existed (apart from the ones developed within projects such as
Hector, Pelops and Lucandra), I decided to take Filip Hanik's excellent
jdbc-pool (http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html) and
"port" it to Cassandra.
During the development of the connection pool I had two needs which I solved
locally:
- split the org.apache.cassandra.thrift class hierarchy from
apache-cassandra-0.x.y.jar into a apache-cassandra-thrift-0.x.y.jar
- have a standard org.apache.cassandra.thrift.CassandraDataSource
interface, which I have defined as:
package org.apache.cassandra.thrift;
import org.apache.cassandra.thrift.Cassandra;
import org.apache.thrift.TException;
public interface CassandraThriftDataSource {
Cassandra.Client getConnection() throws TException;
void releaseConnection(Cassandra.Client connection);
}
In alternative a close() method on the Cassandra.Client interface,
which could be overridden to return the connection to the pool instead
of directly closing the underlying transport, although I believe this
might require changes to thrift.
This would provide a standard method for all client libraries to
obtain and release a connection (via a library, via JNDI, etc).
Would a patch against head be well accepted ?
Thanks for any suggestions
Tristan
Re: Cassandra Connection Pool
Posted by Eric Evans <ee...@rackspace.com>.
On Tue, 2010-10-26 at 16:54 +0200, Tristan Tarrant wrote:
> I have a couple of questions:
>
> - should the org.apache.cassandra.thrift classes still be included in
> the main jar ? Maybe just the ones compiled from src/java ?
I think it's OK to have the main jar depend on the thrift one. And, we
should just stick with what's in interface/thrift/gen-java for a thrift
jar since nothing under src/java is useful to a client.
> - should I also do the same for the avro client classes ?
Yeah, sure.
--
Eric Evans
eevans@rackspace.com
Re: Cassandra Connection Pool
Posted by Tristan Tarrant <tr...@gmail.com>.
On Tue, Oct 26, 2010 at 16:36, Eric Evans <ee...@rackspace.com> wrote:
>
> Sure, can you submit a ticket an attach the patch there?
>
> https://issues.apache.org/jira/browse/CASSANDRA
Hi Eric,
I have a couple of questions:
- should the org.apache.cassandra.thrift classes still be included in the
main jar ? Maybe just the ones compiled from src/java ?
- should I also do the same for the avro client classes ?
Tristan
Re: Cassandra Connection Pool
Posted by Eric Evans <ee...@rackspace.com>.
On Tue, 2010-10-26 at 16:22 +0200, Tristan Tarrant wrote:
> first of all let me introduce myself (or rather what I do). I am the
> developer of the Infinispan Cassandra CacheStore (
> http://community.jboss.org/wiki/CassandraCacheStore) which allows
> persistence of Infinispan's cache to Cassandra's keyspaces. While
> developing the cachestore I needed a connection pool for managing
> thrift connections. Since none existed (apart from the ones developed
> within projects such as Hector, Pelops and Lucandra), I decided to
> take Filip Hanik's excellent jdbc-pool
> (http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html) and
> "port" it to Cassandra.
[ ... ]
> Would a patch against head be well accepted ?
Sure, can you submit a ticket an attach the patch there?
https://issues.apache.org/jira/browse/CASSANDRA
Thanks!
--
Eric Evans
eevans@rackspace.com