Return-Path: Delivered-To: apmail-incubator-cassandra-user-archive@minotaur.apache.org Received: (qmail 23400 invoked from network); 5 Oct 2009 15:59:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Oct 2009 15:59:30 -0000 Received: (qmail 68177 invoked by uid 500); 5 Oct 2009 15:59:30 -0000 Delivered-To: apmail-incubator-cassandra-user-archive@incubator.apache.org Received: (qmail 68159 invoked by uid 500); 5 Oct 2009 15:59:30 -0000 Mailing-List: contact cassandra-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cassandra-user@incubator.apache.org Delivered-To: mailing list cassandra-user@incubator.apache.org Received: (qmail 68150 invoked by uid 99); 5 Oct 2009 15:59:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Oct 2009 15:59:30 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ikatkov@gmail.com designates 209.85.220.209 as permitted sender) Received: from [209.85.220.209] (HELO mail-fx0-f209.google.com) (209.85.220.209) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Oct 2009 15:59:17 +0000 Received: by fxm5 with SMTP id 5so2759915fxm.27 for ; Mon, 05 Oct 2009 08:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type; bh=2IYYd+D/ITyFNexYxZRumRlw+x30h79Qfaz1H20MYNU=; b=AHq0NGdDXfrdpGg2IEoDJK3TRSuTSaN69MFm4qBo6KZhgVI84BpDQAIkPf/+sJvQ1j wTVXcX1sd7CMbWyJ/ocU2GgATnOP84mdGl0D6clRo581+bCsPxstPWko1kDops6uT9IO Jm7fdqQW4TzNRVd00j3orYojCKQZsAUvWwe54= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=JM/J/EXoq7UQfp4QSKPetlSoRrAO/8rm8fW+NsQGzkbnevwSS/YVrhxfn+4ZsBA8SW DOWhPGPko/owAJI7GYNyZgQbSY/QuFDsekaQx1V5y8zCC3rLN9X7eKjD3QaxeeZf1QCc PwC2toRzFGBBhpVsqJEElmtnAqS/m7qG934Rc= MIME-Version: 1.0 Received: by 10.223.17.65 with SMTP id r1mr112449faa.5.1254758277178; Mon, 05 Oct 2009 08:57:57 -0700 (PDT) In-Reply-To: <5676b0940910031334l1ff43cc6o2a28dac4db221197@mail.gmail.com> References: <872340b70910030346u7de1fef1u935d376b40f8e27f@mail.gmail.com> <5676b0940910031334l1ff43cc6o2a28dac4db221197@mail.gmail.com> From: Igor Katkov Date: Mon, 5 Oct 2009 11:57:37 -0400 Message-ID: <23b1e84e0910050857q2a21dcb9n691076a5ec259c2@mail.gmail.com> Subject: Re: Connection Pooling To: cassandra-user@incubator.apache.org Content-Type: multipart/alternative; boundary=001517447d1e63e4200475322de0 X-Virus-Checked: Checked by ClamAV on apache.org --001517447d1e63e4200475322de0 Content-Type: text/plain; charset=ISO-8859-1 As Jonathan Ellis points out one might use common-pool If you also use Spring it makes it very easy to configure, so there are no need to code it yourself. Here is an example Where "cassandraClientTarget" is bean id of your Cassandra client class, the one you'd like to pool. P.S. You need to have commons-pool.jar and spring.jar (or equivalents) in your classpath On Sat, Oct 3, 2009 at 4:34 PM, Mark McBride wrote: > If you're looking for a concrete example, you can probably > transliterate the Scala example in Cassidy > (http://github.com/viktorklang/Cassidy), which uses commons pooling. > Or you could use Cassidy and get pooling for free. > > ---Mark > > On Sat, Oct 3, 2009 at 6:31 AM, Jonathan Ellis wrote: > > It would be pretty easy to create one with > > http://commons.apache.org/pool/. If your number of ops-per-connection > > is already high then pooling is a lower priority. > > > > On Sat, Oct 3, 2009 at 5:46 AM, Johannes Schaback > > wrote: > >> Hi! > >> > >> Just a quick question out of curiosity; is it necessary/sesnsible to > >> use a connection pool if a larger number of clients want to connect to > >> the same node? If yes, does Cassandra/thrift maybe already have a > >> connection pool that I am unaware of? > >> > >> I found lazyboys Python Wrapper for Cassandra which includes a > >> connection pool, but I am wondering if there exists something similar > >> for the Java world. > >> > >> Thanks, > >> > >> Johannes > >> > > > --001517447d1e63e4200475322de0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable As Jonathan Ellis points out one might use common-pool

If you also u= se Spring it makes it very easy to configure, so there are no need to code = it yourself.
Here is an example

=A0=A0=A0 <bean id=3D"cas= sandraClient" class=3D"org.springframework.aop.framework.ProxyFac= toryBean">
=A0=A0=A0=A0=A0=A0=A0 <property name=3D"targetSource" ref=3D&q= uot;poolCassandraClient"/>
=A0=A0=A0 </bean>

=A0=A0= =A0 <bean id=3D"poolCassandraClient" class=3D"org.springf= ramework.aop.target.CommonsPoolTargetSource">
=A0=A0=A0=A0=A0=A0=A0 <property name=3D"targetBeanName" value= =3D"cassandraClientTarget"/>
=A0=A0=A0=A0=A0=A0=A0 <prop= erty name=3D"maxSize" value=3D"50"/>
=A0=A0=A0 &l= t;/bean>

Where "cassandraClientTarget" is bean id of yo= ur Cassandra client class, the one you'd like to pool.

P.S. You need to have commons-pool.jar and spring.jar (or equivalents) = in your classpath


On Sat, Oct 3, 2009= at 4:34 PM, Mark McBride <mark.mcbride@gmail.com> wrote:
If you're loo= king for a concrete example, you can probably
transliterate the Scala example in Cassidy
(http:/= /github.com/viktorklang/Cassidy), which uses commons pooling.
Or you could use Cassidy and get pooling for free.

=A0 ---Mark

On Sat, Oct 3, 2009 at 6:31 AM, Jonathan Ellis <jbellis@gmail.com> wrote:
> It would be pretty easy to create one with
> http://c= ommons.apache.org/pool/. =A0If your number of ops-per-connection
> is already high then pooling is a lower priority.
>
> On Sat, Oct 3, 2009 at 5:46 AM, Johannes Schaback
> <johannes.scha= back@visual-meta.com> wrote:
>> Hi!
>>
>> Just a quick question out of curiosity; is it necessary/sesnsible = to
>> use a connection pool if a larger number of clients want to connec= t to
>> the same node? If yes, does Cassandra/thrift maybe already have a<= br> >> connection pool that I am unaware of?
>>
>> I found lazyboys Python Wrapper for Cassandra which includes a
>> connection pool, but I am wondering if there exists something simi= lar
>> for the Java world.
>>
>> Thanks,
>>
>> Johannes
>>
>

--001517447d1e63e4200475322de0--